View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default count 1st cell and last cell that contain specific word

Hi
Post the question in

microsoft.public.excel.worksheetfunctions

to avoid disappointment!
Paul

On Feb 22, 2:31*pm, "crapit" wrote:
err, possible not to use macro? formula

wrote in message

...
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- Hide quoted text -


- Show quoted text -