count 1st cell and last cell that contain specific word
Hi
Assuming Your column A data has a heading
Sub tester()
Dim firstCell As Range, lastCell As Range
With Range("A:A")
Set firstCell = .Find("grp", SearchDirection:=xlNext)
Set lastCell = .Find("grp", SearchDirection:=xlPrevious)
End With
MsgBox "First Cell address is " & firstCell.Address
MsgBox "Last Cell address is " & lastCell.Address
End Sub
The first cell tested is A2 for firstcell and last row of data for
lastcell.
Check the find method Help if you want to specify different start
cells for searching.
regards
Paul
On Feb 22, 2:06*pm, "crapit" wrote:
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?
* * * *A * * * *B * * * *C
1
2 * grp
3 * grp
4
5 * grp
6
7 * hex
8 * hex
9 * hex
10 grp
11 grp
|