i'm trying to lookup an email in a column, then use that email's location to find other information in the relevant row. here's my code so far:
Dim wsUsers As Worksheet
Set wsUsers = Worksheets("userOutput.csv")
Dim userRows As Integer
userRows = wsUsers.Cells(Rows.Count, 1).End(xlUp).Row
Dim userEmail As Range
Dim userEmailColumn As Range
Set userEmailColumn = wsUsers.Range(Cells(2, 4), Cells(userRows, 4))
Dim findEmail As Variant
Set findEmail = userEmailColumn.Find("[email protected]")
Dim userEmailAd As Range
Set userEmailAd = findEmail.Address
MsgBox userEmailAd
stop
I'm getting runtime error 424, object required
and it highlights the line: Set userEmailAd = findEmail.Address
How do I get a range so I can then use offset to find other information in the row? Or, is there a better way? I'm not using vlookup because column is not the first one in the overall range.
userRows = wsUsers.Cells(Rows.Count, 1).End(xlUp).Row
Set userEmailColumn = wsUsers.Range(Cells(2, 4), Cells(userRows, 4))
should rather be:
userRows = wsUsers.Cells(wsUsers.Rows.Count, 1).End(xlUp).Row
Set userEmailColumn = wsUsers.Range(wsUsers.Cells(2, 4), wsUsers.Cells(userRows, 4))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments