VBA: Extracting Range from worksheet and inserting into userform

M

Mcasteel

Im am receiving the above error with the following code.

Dim iRow As String
Dim CustSSN As String

'Fill variable with User Inputed Cust. SSN
CustSSN = txtCustSSN

iRow = WorksheetFunction.Match(CustSSN
Worksheets("sheet1").Range("f:f300"), 0)
If iRow = 0 Then
MsgBox "Customer SSN Was Not Found"
Else
MsgBox "Record Found"

End If

End Sub

The error is highlighting the first line of the above code
 
B

Bob Phillips

Line-wrap?

Dim iRow As String
Dim CustSSN As String

'Fill variable with User Inputed Cust. SSN
CustSSN = txtCustSSN

iRow = WorksheetFunction.Match(CustSSN, _
Worksheets("sheet1").Range("f:f300"), 0)
If iRow = 0 Then
MsgBox "Customer SSN Was Not Found"
Else
MsgBox "Record Found"

End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top