Hello everyone
I'd like to say thanks in advance for any help.
In my project I have a search function that has to search a row for a number and if the number is found, it should return all data written on the spreadsheet row to respective text and comboboxes on the userform, but I recieve a run-time error 424 object required error and the line that gets highlighted is *For each c in DataBase.range("C:C").cells* and I don't know why. Here is my piece of code below. DataBase is the name of the spreadsheet which must be searched and the searched numbers are always in column C. If a different approach can be used please help me with them. I hope I was clear enough.
Private Sub cmdSearch_Click()
For Each c In DataBase.Range("C:C").Cells
If c.Value <> "" Then
If cboJobCardNo.Value = c.Value Then
txtRequester.Value = c.Offset(0, -2).Value
txtDate.Value = c.Offset(0, -1).Value
cboDept.Value = c.Offset(0, 1).Value
cboFacility.Value = c.Offset(0, 2).Value
cboEquip.Value = c.Offset(0, 3).Value
cboItem.Value = c.Offset(0, 4).Value
cboProbType.Value = c.Offset(0, 5).Value
txtProbDescription.Value = c.Offset(0, 6).Value
MsgBox "Now you can update.", vbInformation, "UPDATE ENTRY"
Else
End If
Else
Exit Sub
End If
Next
End Sub
zbor I apologize for that...I thought using [code] before and after the code would work...I am still new so am really sorry.
Bookmarks