I'm trying to find a value in a list. I've written some code that is able to find the value just find, ie a msgbox will say "found the value at E8", but I'd like to be able to bring the active cell to where the value is found. ie I'd like Excel to bring the cursor to E8. can anyone advise?
Here's the code. I've commented out the one line where I tried to activate the relevant cell. That command gave a compile error.
Btw I haven't posted much code here before, what is the etiquette when doing so? I'm guessing it's not just to paste the code in here?
For Each cell In Range("E1:E30")
If cell.Value = search Then
'cell.Row.Activate (this command gave the error)
MsgBox "found the value at " & "Cell E" & (i + 1)
Exit For
End If
i = i + 1
Next cell
Here's the code. I've commented out the one line where I tried to activate the relevant cell. That command gave a compile error.
Btw I haven't posted much code here before, what is the etiquette when doing so? I'm guessing it's not just to paste the code in here?
For Each cell In Range("E1:E30")
If cell.Value = search Then
'cell.Row.Activate (this command gave the error)
MsgBox "found the value at " & "Cell E" & (i + 1)
Exit For
End If
i = i + 1
Next cell