Hello,
I am getting an object variable or with block variable not set error when I add this line "Unload DataEntryElGr" to my code and I can't figure out why, the code runs perfect until I add it....
The sub is in the "DataEntryElGr" userform, The purpose of this string is simply to close the form instead of having to click on the "X". I appreciate any input - thanks,
I am getting an object variable or with block variable not set error when I add this line "Unload DataEntryElGr" to my code and I can't figure out why, the code runs perfect until I add it....
The sub is in the "DataEntryElGr" userform, The purpose of this string is simply to close the form instead of having to click on the "X". I appreciate any input - thanks,
Code:
Private Sub UserForm_Initialize()
Dim i As Long
Dim Lastrow As Long
'this is from the DEVICE ID column
If ThisWorkbook.Sheets("Emergency Lighting Log").Range("M1").Value = 0 Then
MsgBox " All emergency lighting has been inspected in this area, please continue on to the next inspection area. "
EmergencyLightArea.Show
[COLOR=#ff0000] Unload DataEntryElGr[/COLOR]
Else
Lastrow = Cells(Rows.Count, "L").End(xlUp).Row
For i = 1 To Lastrow
If Cells(i, 15).Value = "" Then ListBox1.AddItem Cells(i, 12).Value
Next
Me.TextBox4.Text = CStr(ThisWorkbook.Sheets("Emergency Lighting Log").Range("M1").Value)
TextBox1.SetFocus
End If
End Sub