When using For Each cell in Range, I would like to use the cell.row property to refer to the row of the current cell. However if I use it in another Sub, I get the error Run-time error:'424' Object required.
Below is a simple code to illustrate what I mean. Am I doing anything wrong or is there a way to refer to the row of the current cell in another Sub? Thanks!
Sub CommandButton2_Click()
Dim rng As Range
Set rng = Range("P290:P293")
For Each cell In rng
Third
Next cell
End Sub
Sub Third()
MsgBox cell.row
End Sub
No comments:
Post a Comment