So I am trying to find the row number of a cell which contains the value “SOI 1”. The message box returns the correct number, but when I try to assign that number to a variable for later use I get the compile error:
“Wrong number of arguments or invalid property assignment”
I’m fairly new to VBA, so any help you guys can provide would be amazing!
Public Sub Testing()
Dim rFind As Range
Dim row_SOI1 As Integer
test = "SOI 1"
With Range("A1:A100")
Set rFind = .Find(What:="SOI 1", LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
MsgBox rFind.Row
If test = "SOI 1" Then:
rFind.Row = row_SOI1
End If
End If
End With
End Sub