View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How do I identify a range based on cell value?

Try

Sub AAA()
Dim RowNdx As Long
Dim StartFound As Boolean
For RowNdx = 1 To Rows.Count
If StrComp(Cells(RowNdx, 1).Value, "A", vbTextCompare) = 0
Then
If StartFound = False Then
Cells(RowNdx, 1).Name = "StartOfA"
StartFound = True
Else
Cells(RowNdx, 1).Name = "EndOfA"
End If
End If
Next RowNdx
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"HBF" wrote in
message ...

I have data sorted by a column. I want to loop down thru the
column
until the value = "A". I want to name that cell somthing like
"start
of A". Then I want to loop through the column until the last
value =
"A", and name that "end of "A". Then I want to select the
range "start
of A:end of A"

Thanks for your help


--
HBF
------------------------------------------------------------------------
HBF's Profile:
http://www.excelforum.com/member.php...o&userid=34019
View this thread:
http://www.excelforum.com/showthread...hreadid=552410