Vivek Roshan
New Member
- Joined
- Feb 15, 2018
- Messages
- 24
hi Mr. Fluff
I have added search command button to userform in excel VBA and wanted to search the data through the dates displayed in combobox. The idea is to search date in worksheet called ICC_Data and if it finds, then it will display the data in TextBox1, TextBox2 and TextBox3 of userform. When I am selecting the date in combobox and pressing search command button. First, it coverts the date into 5 digit value and then shows an error as:
Runtime error 91, object variable or with block variable is not set.
My code is given below and in my Workbook Sheet2 is named as ICC_Data.
-------------------------------------------------------------------------------------
Private Sub CmdSearch_Click()
Dim Findvalue As Range
Set Findvalue = Sheet2.Range("A:A").Find(what:=Me.ComboBox1.Value, LookIn:=xlFormulas, lookat:=xlWhole)
Me.TextBox1.Value = Findvalue.Value
Me.TextBox2.Value = Findvalue.Offset(0, 1).Value
Me.TextBox3.Value = Findvalue.Offset(0, 2).Value
End sub
---------------------------------------------------------------------------------------------------------
Can you please help me to resolve this problem.
Regards,
I have added search command button to userform in excel VBA and wanted to search the data through the dates displayed in combobox. The idea is to search date in worksheet called ICC_Data and if it finds, then it will display the data in TextBox1, TextBox2 and TextBox3 of userform. When I am selecting the date in combobox and pressing search command button. First, it coverts the date into 5 digit value and then shows an error as:
Runtime error 91, object variable or with block variable is not set.
My code is given below and in my Workbook Sheet2 is named as ICC_Data.
-------------------------------------------------------------------------------------
Private Sub CmdSearch_Click()
Dim Findvalue As Range
Set Findvalue = Sheet2.Range("A:A").Find(what:=Me.ComboBox1.Value, LookIn:=xlFormulas, lookat:=xlWhole)
Me.TextBox1.Value = Findvalue.Value
Me.TextBox2.Value = Findvalue.Offset(0, 1).Value
Me.TextBox3.Value = Findvalue.Offset(0, 2).Value
End sub
---------------------------------------------------------------------------------------------------------
Can you please help me to resolve this problem.
Regards,