Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi hope you can help me please, i have the following code below which works fine for me it does a count into my Textbox2, but i then get a 'Run'time error '91: Object variable or With block variable not set. Please can you help me, it also comes up highlighted yellow for UserForm1.
VBA Code:
Private Sub userform_initialize()
With UserForm1.TextBox2
Dim j As Long
j = Application.WorksheetFunction.CountIf(ThisWorkbook.Sheets("In Day VL").Range("A:A"), "CAG")
UserForm1.TextBox2.Value = j
End With
UserForm1.Show
End Sub