Select a cell
give this a try
Option Explicit
Dim x As Long
Dim lastrow As Long
Sub Find_Last()
With Sheets("TEST")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For x = lastrow To 1 Step -1
If InStr(1, (.Cells(x, 1).Value), "BATCH") Then
Range("A" & x).Select
Exit For
End If
Next x
End With
End Sub
--
Gary
"slowjam4" wrote in message
oups.com...
Can someone give me the correct syntax to select the last cell in
column A which contains the word "BATCH" ?
Sub Find_Last()
Sheets("TEST").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For x = lastrow To 1 Step -1
If InStr(1, (Cells(x, 1).Value), "BATCH") 0 Then
Range("A" & x, 1).Select
Exit For
End If
Next x
End Sub
I think everything is correct except the Range statement. What should I
replace it with to place my cursor in the last cell that contains the
word "BATCH"?
|