Good day all. I have a snipit of code that is on the usersform1 code sheet that runs on initialization of usersform1. However when it errors on <> "Blank" (in Sheet1 row x : cell H) the userform1 loads with the values in "Properties, Appearance, Value" (used this to debug). (not sure if this is the right wording)
thanks in advance for the help.
VBA Code:
Sub Initialization_Form
Dim emptyRow As Long
'selects active sheet for checking if row x is ready.
Sheet1.Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("i:i")) + 1 '<---------used to find first unused row in column i
'verify "blank" in first unused row, cell h
'MsgBox Sheets(1).Cells(emptyRow, 8).Text '<---------debugging Msgbox
'On Error Resume Next ' <---------debugging statement will set once below issue is fixed.
If Sheets(1).Cells(emptyRow, 8).Text = "Blank" Then '<---------check to see if next row has "Blank" in the "H" cell
TextBox4 = "Blank" '<---------put this in the TextBox4 if row is "Blank"
Else: '<---------if cell H is not "Blank" show message and stop intiliziation and unload (me)
MsgBox "There seems to be an error" & Sheets(1).Cells(emptyRow, 8).Text & " is not ready.", 16, "DATA ERROR"
Unload (UserForm1) '<----------------------------- this is the issue. if this is not in the userform1 shows up after the sub exits
Exit Sub
MsgBox "sub exited", 16, "Fix Error" '<--------------Debugging MsgBox
End If
'rest of code to set all text boxs to ""
'as apposed to what is in the "Properties, Appearance, Value" (debugging)
End Sub
thanks in advance for the help.