Form validates data before submitting - vba

I'm a beginner when it comes to VB and i'm having a bit of trouble developing a form. What i'm trying to achieve is for the form, on click,to:
Validate four text boxes and nine combo boxes, ensuring they all have values before being submitted to an MS Excel sheet
If there are null fields, a message box telling the user "Text box(es) and/or drop down box(es) must contain data" (or something to that effect) should appear
Assuming all fields have values, the workbook must be unprotected
Data must then be input into the Excel sheet (each form submission equals one row of data, which must not be overwritten by subsequent entries).
The workbook must be protected again
The form must be hidden once all actions are complete.
Here's my code so far. I'm sure its very simplistic and can be made more efficient -- any suggestions welcome. Thank you in advance for your help.
Private Sub CommandButton1_Click()
Sheet2.Unprotect
Dim LastRow As Object
Set LastRow = Sheet2.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = ExpRecDrop.Text
Set LastRow = Sheet2.Range("b65536").End(xlUp)
LastRow.Offset(1, 0).Value = CPName.Text
Set LastRow = Sheet2.Range("c65536").End(xlUp)
LastRow.Offset(1, 0).Value = ConEntDrop.Text
Set LastRow = Sheet2.Range("d65536").End(xlUp)
LastRow.Offset(1, 0).Value = ResTypDrop.Text
Set LastRow = Sheet2.Range("e65536").End(xlUp)
LastRow.Offset(1, 0).Value = LangDrop.Text
Set LastRow = Sheet2.Range("f65536").End(xlUp)
LastRow.Offset(1, 0).Value = WritDrop.Text
Set LastRow = Sheet2.Range("g65536").End(xlUp)
LastRow.Offset(1, 0).Value = OwnerDrop.Text
Set LastRow = Sheet2.Range("i65536").End(xlUp)
LastRow.Offset(1, 0).Value = BiRiDrop.Text
Set LastRow = Sheet2.Range("j65536").End(xlUp)
LastRow.Offset(1, 0).Value = ERTextBox.Text
Set LastRow = Sheet2.Range("k65536").End(xlUp)
LastRow.Offset(1, 0).Value = DueDatDrop.Text
Set LastRow = Sheet2.Range("l65536").End(xlUp)
LastRow.Offset(1, 0).Value = SubTypDrop.Text
Set LastRow = Sheet2.Range("o65536").End(xlUp)
LastRow.Offset(1, 0).Value = CommText.Text
Sheet2.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Me.Hide
MsgBox "One record written to the 2014 tab"
End Sub
This is my first post so please let me know if you need any more information.

You could try this. I've created a Boolean (True/False) variable to determine if the update should happen, if any of your controls is blank it will change to false and skip the update. The other change I've made is instead of repeatedly working out the next available cell is to work out the next free row number once and use that as a reference to the row to populate.
Private Sub CommandButton1_Click()
Dim LastRow As Long
Dim isOk As Boolean
sheet2.Unprotect
' Create boolean variable as true and check controls for data, if any data missing, change to false
isOk = True
If ExpRecDrop.Text = "" Then isOk = False
If CPName.Text = "" Then isOk = False
If ConEntDrop.Text = "" Then isOk = False
If ResTypDrop.Text = "" Then isOk = False
If LangDrop.Text = "" Then isOk = False
If WritDrop.Text = "" Then isOk = False
If OwnerDrop.Text = "" Then isOk = False
If BiRiDrop.Text = "" Then isOk = False
If ERTextBox.Text = "" Then isOk = False
If DueDatDrop.Text = "" Then isOk = False
If SubTypDrop.Text = "" Then isOk = False
If CommText.Text = "" Then isOk = False
' if boolean value is still true, update the sheet, else display error message
If Not isOk Then
With sheet2
' get number of the next free row
Set LastRow = .Range("a65536").End(xlUp).Row + 1
' Populate the sheet
.Cells(LastRow, 1).Value = ExpRecDrop.Text
.Cells(LastRow, 2).Value = CPName.Text
.Cells(LastRow, 3).Value = ConEntDrop.Text
.Cells(LastRow, 4).Value = ResTypDrop.Text
.Cells(LastRow, 5).Value = LangDrop.Text
.Cells(LastRow, 6).Value = WritDrop.Text
.Cells(LastRow, 7).Value = OwnerDrop.Text
.Cells(LastRow, 8).Value = BiRiDrop.Text
.Cells(LastRow, 9).Value = ERTextBox.Text
.Cells(LastRow, 10).Value = DueDatDrop.Text
.Cells(LastRow, 11).Value = SubTypDrop.Text
.Cells(LastRow, 12).Value = CommText.Text
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
' Hide userform and confirm
Me.Hide
MsgBox "One record written to the 2014 tab"
Else
' Error message
MsgBox "Some data missing"
End If
End Sub

Related

VBA: Excel Macro executes correctly in debug, but does not run sub when executed

My code is to reference a named range(Pump Number), find the last instance in a table(another sheet), copy the row it was found in and paste that data in the new row that was created in the table. It is then to loop trough a series of cells on another sheet and find true values. If the value is true it is to copy another named range(Hours) and paste that value into the table in the correct column. The code executes correctly in debug, stepping through one line at a time, but when ran normally, it does not copy the last line of data in the table and paste the values in the new row. The code where it does not work properly starts at line 90
Sub SavePumpMaintenance()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim tbla As ListObject, last_row, total_stage As Integer
Dim issue, pump, pump_hrs, main_date, main_code As String
Dim correct_plunger, correct_part As Boolean, Data As Worksheet
Dim Maint As Worksheet, wSheet As Worksheet, r As Long
Dim tbl As ListObject, newrow As ListRow, i As Long
Dim cells As Range, LR As Integer, Hist As Worksheet
Set Hist = Sheet26
Set CurrentHours = Range("CurrentHours")
Set tbl = Hist.ListObjects("Historical")
Set newrow = tbl.ListRows.Add
Set Data = Sheet5
Set Maint = Sheet3
Set tbla = Maint.ListObjects("MaintPerformed")
correct_plunger = Data.Range("N6").Value
correct_part = Data.Range("N10").Value
main_code = Data.Range("Y8").Value
issue = Data.Range("Y11").Value
last_row = Data.Range("N11").Value
pump = Maint.Range("C6").Value
pump_hrs = Maint.Range("C7").Value
main_date = Maint.Range("C8").Value
total_stage = Maint.Range("C9").Value
LR = tbl.Range(Rows.Count).End(xlUp).Row
'Unprotect all sheets
For Each wSheet In Worksheets
wSheet.Unprotect Password:="SomePassword"
Next wSheet
If pump = "" Then
MsgBox "Please select a pump."
Application.Calculation = xlCalculationAutomatic
Exit Sub
End If
If pump_hrs = "" Then
MsgBox "Please enter hours."
Application.Calculation = xlCalculationAutomatic
Exit Sub
End If
If Range("Date") = "" Then
MsgBox "Please enter date and time of maintenance."
Application.Calculation = xlCalculationAutomatic
Exit Sub
End If
If correct_plunger = False Then
MsgBox "Incorrect plunger type selected"
Application.Calculation = xlCalculationAutomatic
Exit Sub
End If
If correct_part = False Then
MsgBox "Incorrect part type selected"
Application.Calculation = xlCalculationAutomatic
Exit Sub
End If
Data.Range("T3:T37").Copy 'Copy used parts/pump info to maintenance table
Maint.Range("O1").Offset(last_row,0).PasteSpecial xlValues,Transpose:=True
Data.Range("U3:U12").Copy
Maint.Range("BJ1").Offset(last_row,0).PasteSpecial xlValues,Transpose:=True
Maint.Range("J1").Offset(last_row, 0).Value = pump
Maint.Range("J1").Offset(last_row, 1).Value = pump_hrs
Maint.Range("J1").Offset(last_row, 2).Value = total_stage
Maint.Range("J1").Offset(last_row, 3).Value = main_date
Maint.Range("J1").Offset(last_row, 4).Value = main_code
Maint.Range("J1").Offset(last_row, 63).Value = issue
'Copy last set of historical data for pump 'add maintenance to history
For r = 1 To LR Step 1
If tbl.Range(r, 1).Value = Range("Pumpnumber") Then
Range("H" & r & ":V" & r).Copy
newrow.Range(8).PasteSpecial Paste:=xlValues
End If
Next r
With newrow 'Paste current pump information
.Range(1) = Range("Pumpnumber")
.Range(2) = Range("Date")
.Range(3) = CurrentHours
.Range(4) = Range("Position")
.Range(5) = Range("Fleet")
.Range(6) = Range("WFNumb")
.Range(7) = Range("OStage")
End With
'copy hours from maintenance if checked into maint. history
For i = 1 To 5
If Maint.cells(13, i + 2).Value = True Then
CurrentHours.Copy
newrow.Range(7 + i).PasteSpecial xlPasteValues
End If
If Maint.cells(16, i + 2).Value = True Then
CurrentHours.Copy
newrow.Range(12 + i).PasteSpecial xlPasteValues
End If
If Maint.cells(21, i + 2).Value = True Then
CurrentHours.Copy
newrow.Range(17 + i).PasteSpecial xlPasteValues
End If
If Maint.cells(22, i + 2).Value = True Then
CurrentHours.Copy
newrow.Range(17 + i).PasteSpecial xlPasteValues
End If
Next i
Application.CutCopyMode = False
Dim mp As Range, P As Range 'Copy Current hrs to Equipment Sheet
Set mp = Range("MyPumps")
For Each P In mp
If P.Value = Range("PumpNumber") Then
P.Offset(0, 5).Value = Range("CurrentHours")
End If
Next P
Sheet3.Protect Password:="MyPassword" 'Protect sheets
Sheet5.Protect Password:="MyPassword"
Sheet16.Protect Password:="MyPassword"
Sheet25.Protect Password:="MyPassword"
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

How do i get to next form in visual basic

I am trying to get to the next form for my excel macro
right now I have a login form that has user name and password
that works when I press login it goes to next form.
but when I go to my next form and type the information in it it closes and doesn't pull up the next forum.
Can someone please explain to me what I am doing wrong? why wont my next form pop up?
Private Sub cmdAdd_Click()
'Dim iRow As Long
'Dim ws As Worksheet
Set ws = Worksheets("D544 Back Panel")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a part number
If Trim(Me.txtPrd.Value) = "" Then
Me.txtPrd.SetFocus
MsgBox "Please enter a Production Number"
Exit Sub
End If
'copy the data to the database
'use protect and unprotect lines,
' with your password
' if worksheet is protected
With ws
' .Unprotect Password:="Password"
.Cells(iRow, 1).Value = Me.txtDate.Value
.Cells(iRow, 2).Value = Me.txtHrs.Value
.Cells(iRow, 3).Value = Me.txtPrd.Value
.Cells(iRow, 4).Value = Me.txtSrp.Value
.Cells(iRow, 5).Value = Me.txtOper.Value
' .Protect Password:="Password"
End With
'clear the data
Me.txtDate.Value = ""
Me.txtHrs.Value = ""
Me.txtPrd.Value = ""
Me.txtSrp.Value = ""
Me.txtOper.Value = ""
Me.txtPrd.SetFocus
Unload Me
End Sub
Private Sub cmdSubmit_Click()
'Dim iRow As Long
'Dim ws As Worksheet
Set ws = Worksheets("Scrap")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a part number
If Trim(Me.txtPress.Value) = "" Then
Me.txtPress.SetFocus
MsgBox "Please enter press scrap"
Exit Sub
End If
'copy the data to the database
'use protect and unprotect lines,
' with your password
' if worksheet is protected
With ws
' .Unprotect Password:="Password"
.Cells(iRow, 1).Value = Me.txtDelam.Value
.Cells(iRow, 2).Value = Me.txtCuts.Value
.Cells(iRow, 3).Value = Me.txtBurns.Value
.Cells(iRow, 4).Value = Me.txtDents.Value
.Cells(iRow, 5).Value = Me.txtStaple.Value
.Cells(iRow, 6).Value = Me.txtGlue.Value
.Cells(iRow, 7).Value = Me.txtPress.Value
' .Protect Password:="Password"
End With
'clear the data
Me.txtDelam.Value = ""
Me.txtCuts.Value = ""
Me.txtBurns.Value = ""
Me.txtDents.Value = ""
Me.txtStaple.Value = ""
Me.txtGlue.Value = ""
Me.txtPress.Value = ""
Me.txtPress.SetFocus
Unload Me
End Sub
I used
Formname1.Hide
Formname2.Show
This seemed to solve my issue. Thanks for the help guys. Sorry I am very new to this site.

Find Last Row In A Group Of Columns

I have a userform that enters data into columns I to S but sometimes all data points does not need to be entered. My probably is I only have the last row counting up on column I so if I have data in J through S, they would get replaced with the next set of data that has data in column I.
What I need help is coding for the last row of all columns or the next blank row of all columns. Thanks.
My code:
Private Sub cmd_EnterData_Click()
Dim iRow As Long
Dim Lastrow As Long
Dim ws As Worksheet
Set ws = Worksheets("FirstShift")
Lastrow = ws.Range("i101").End(xlUp).Row
'find first empty row in database
For iRow = 16 To Lastrow
If ws.Cells(iRow, 9) = "" And ws.Cells(iRow, 10) = "" Then
ws.Cells(iRow, 9).Value = Me.textbox_Lane1.Value
ws.Cells(iRow, 10).Value = Me.textbox_Lane2.Value
ws.Cells(iRow, 11).Value = Me.textbox_Lane3.Value
ws.Cells(iRow, 12).Value = Me.textbox_Lane4.Value
ws.Cells(iRow, 13).Value = Me.textbox_Lane5.Value
ws.Cells(iRow, 14).Value = Me.textbox_Lane6.Value
ws.Cells(iRow, 15).Value = Me.textbox_Lane7.Value
ws.Cells(iRow, 16).Value = Me.textbox_Length.Value
ws.Cells(iRow, 17).Value = Me.textbox_SheetCount.Value
ws.Cells(iRow, 18).Value = Me.cbchecktype.Value
ws.Cells(iRow, 19).Value = Me.cbchecktype1.Value
End If
Next iRow
If checkbox_Retest.Value = False And Me.textbox_Lane1.Value = "" Then
'do nothing
Me.textbox_Lane1.SetFocus
MsgBox "ENTER LANE 1 WIDTH!"
Exit Sub
End If
If checkbox_Retest.Value = False And Me.textbox_Length.Value = "" Then
'do nothing
Me.textbox_Length.SetFocus
MsgBox "ENTER YOUR LENGTH!"
Exit Sub
End If
If checkbox_Retest.Value = False And Me.textbox_SheetCount.Value = "" Then
'do nothing
Me.textbox_SheetCount.SetFocus
MsgBox "ENTER THE SHEETCOUNT!"
Exit Sub
End If
If checkbox_Retest.Value = False And Me.cbchecktype.Value = "" Then
'do nothing
Me.cbchecktype.SetFocus
MsgBox "ENTER 'PASS' OR 'FAIL' FOR PERF CHECK!!"
Exit Sub
Select Case checktype
Case Trim(Me.cbchecktype.Value) = "PASS"
checktype = "PASS"
Case Trim(Me.cbchecktype.Value) = "FAIL"
checktype = "FAIL"
End Select
End If
If checkbox_Retest.Value = False And Me.cbchecktype1.Value = "" Then
'do nothing
Me.cbchecktype1.SetFocus
MsgBox "ENTER 'PASS' OR 'FAIL' FOR SLITHER CHECK!!"
Exit Sub
Select Case checktype1
Case Trim(Me.cbchecktype1.Value) = "PASS"
checktype1 = "PASS"
Case Trim(Me.cbchecktype1.Value) = "FAIL"
checktype1 = "FAIL"
End Select
End If
With ws
.Unprotect Password:="password"
.Cells(iRow, 9).Value = Me.textbox_Lane1.Value
.Cells(iRow, 10).Value = Me.textbox_Lane2.Value
.Cells(iRow, 11).Value = Me.textbox_Lane3.Value
.Cells(iRow, 12).Value = Me.textbox_Lane4.Value
.Cells(iRow, 13).Value = Me.textbox_Lane5.Value
.Cells(iRow, 14).Value = Me.textbox_Lane6.Value
.Cells(iRow, 15).Value = Me.textbox_Lane7.Value
.Cells(iRow, 16).Value = Me.textbox_Length.Value
.Cells(iRow, 17).Value = Me.textbox_SheetCount.Value
.Cells(iRow, 18).Value = Me.cbchecktype.Value
.Cells(iRow, 19).Value = Me.cbchecktype1.Value
.Protect Password:="password"
End With
'clear the data
Me.textbox_Lane1.Value = ""
Me.textbox_Lane2.Value = ""
Me.textbox_Lane3.Value = ""
Me.textbox_Lane4.Value = ""
Me.textbox_Lane5.Value = ""
Me.textbox_Lane6.Value = ""
Me.textbox_Lane7.Value = ""
Me.textbox_Length.Value = ""
Me.textbox_SheetCount.Value = ""
Me.cbchecktype.Value = ""
Me.cbchecktype1.Value = ""
Me.checkbox_Retest.Value = False
Me.Hide
End Sub
A.S.H, I've tried your code and same thing is happening BUT I don't think its the code. Please see pictures of before and after. I think the problem is my IF STATEMENT:
"If ws.Cells (iRow, 9) = "" And ws.Cells(iRow, 10) = "" Then
As you can see, the function works fine when I have an item in columns 9 (I) and 10 (J), but when I put no data in those two columns then it gets replaced with whatever data I've entered on my userform as long as it includes data in columns 9 or 10..Thoughts on correcting this?
The following gets you the last non-empty row considering all columns:
Lastrow = ws.UsedRange.Find("*", , , , xlByRows, xlPrevious).Row
You can also restrict it to a set of columns, by replacing .UsedRange to the specific columns range, i.e. the following gets you the last non-empty row in columns G to AB:
Lastrow = ws.Range("G:AB").Find("*", , , , xlByRows, xlPrevious).Row
Add these two dim statements.
Dim ColumnCount As Integer
Dim x As Long
Change your code:
Lastrow = ws.Range("i101").End(xlUp).Row
to:
Lastrow = 0
For ColumnCount = 0 To 10
x = ws.Range("I101").Offset(0, ColumnCount).End(xlUp).Row
If x > Lastrow Then Lastrow = x
Next ColumnCount
edit:
This for loop always start on 16. Is it maybe supposed to start on Lastrow+1?
For iRow = 16 To Lastrow

VBA Programming. Error or Prompt will appear in Userform if field in sheet already has content

I wanted to have a code wherein there will be an error or prompt in the userform if the cell in the sheet- wherein the data will be transferred, already has content. As of now, the code I'm using doesn't show any prompt but it succeeds in not updating the cell if a data is to be transferred to it again.
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub ClearButton_Click()
Call UserForm_Initialize
End Sub
Private Sub OKButton_Click()
Dim emptyRow As Long
'Make Sheet1 active
Sheet1.Activate
'Determine emptyRow
Dim rFound As Range: Set rFound = Range("B:B").Find(BarcodeTextBox.Value, , , xlWhole)
If rFound Is Nothing Then
emptyRow = Range("B" & Rows.Count).End(xlUp).Row + 1
Else
emptyRow = rFound.Row
End If
'Transfer information
If TimeOptionButton1.Value = True Then
Cells(emptyRow, 5).Value = "Yes"
End If
If TimeOptionButton2.Value = True Then
Cells(emptyRow, 7).Value = "Yes"
End If
If BreakOptionButton1.Value = True Then
Cells(emptyRow, 9).Value = "Yes"
End If
If BreakOptionButton2.Value = True Then
Cells(emptyRow, 11).Value = "Yes"
End If
If BreakOptionButton3.Value = True Then
Cells(emptyRow, 14).Value = "Yes"
End If
If BreakOptionButton4.Value = True Then
Cells(emptyRow, 16).Value = "Yes"
End If
Cells(emptyRow, 2).Value = BarcodeTextBox.Value
Set ws = ActiveSheet
Me.TextBox1 = Application.WorksheetFunction. _
CountIf(ws.Range("$T$2:$E$977"), "IN")
Me.TextBox2 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "LF")
Me.TextBox3 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "READYMAN")
Me.TextBox4 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "B-MIRK")
Me.TextBox5 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "VISITOR")
End Sub
Private Sub UserForm_Initialize()
'Set Time In as default
TimeOptionButton1.Value = True
'Empty BarcodeTextBox
BarcodeTextBox.Value = ""
Set ws = ActiveSheet
Me.TextBox1 = Application.WorksheetFunction. _
CountIf(ws.Range("$T$2:$E$977"), "IN")
Me.TextBox2 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "LF")
Me.TextBox3 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "READYMAN")
Me.TextBox4 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "B-MIRK")
Me.TextBox5 = Application.WorksheetFunction. _
CountIf(ws.Range("$U$2:$U$977"), "VISITOR")
End Sub
Thank you in advance!
Concerning your code, I think that you may add something like this:
If TimeOptionButton1.Value = True Then
if len(cells(emptyRow,5)) = 0 then
MsgBox "Write Error Message here"
else
Cells(emptyRow, 5).Value = "Yes"
end if
End If
For each yes. You may consider building a separate function/sub later to avoid repetition.

Excel user form combobox once submitted output to excel

I am relatively new to the whole VBA so any help would be greatly appreciated...
I am having issues with getting my Combobox on my form (once you hit the submit button) to input the information to my excel spreadsheet in a specific column which would move down a row each time a new record is entered.
Please see my code below and If you need any further information please ask away :) Many Thanks in advance Paula
Option Explicit
Private Sub cmdAdd_Click()
Dim irow As Long
Dim EorP As String
Dim ComboStaus As ComboBox
Dim ws As Worksheet
Set ws = Worksheets("BS Personal Data")
'find first empty row in spreadsheet
irow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
EorP = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
Combo = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'copy the data to the spreadsheet
With ws
.Cells(irow, 1).Value = Me.txtmanager.Value
.Cells(irow, 2).Value = Me.txtdivision.Value
.Cells(irow, 3).Value = Me.txtlocation.Value
.Cells(irow, 4).Value = Me.txtsystemname.Value
.Cells(irow, 9).Value = Me.Txtpurpose.Value
.Cells(irow, 10).Value = Me.txtaccess.Value
.Cells(irow, 11).Value = Me.txtdatecompleted.Value
End With
'clear the data
Me.txtmanager.Value = ""
Me.txtdivision.Value = ""
Me.txtlocation.Value = ""
Me.txtsystemname.Value = ""
Me.Txtpurpose.Value = ""
Me.txtaccess.Value = ""
Me.txtdatecompleted.Value = ""
'set option button to input data based on type of information to column 5
With ws
If OptElectronic Then
.Cells(EorP, 5).Value = "Electronic"
Else
.Cells(EorP, 5).Value = "PaperBased"
End If
End With
'set option button to input data based on personal data into column 7
With ws
If PersonalYes Then
.Cells(EorP, 7).Value = "Yes"
Else
.Cells(EorP, 7).Value = "No"
End If
End With
'set option button to input data based on privacy notes into column 8
With ws
If PrivacyYes Then
.Cells(EorP, 8).Value = "Yes"
Else
.Cells(EorP, 8).Value = "No"
End If
End With
End Sub
'combo button setup
Private Sub UserForm_Activate()
ComboStatus.Clear
With ComboStatus 'this loads the combo
.AddItem ""
.AddItem "Live"
.AddItem "Archived"
.AddItem "zzz"
End With
End Sub
'close button on the form
Private Sub cmdClose_Click()
Unload Me
End Sub