Private Sub CommandButton1_Click()
ActiveSheet.Range("A1").Select
With Cells
For Each cell In Columns
If ActiveCell.Offset(0, 0) = "A" Then
ActiveCell.Offset(0, 0) = "Start of A"
ActiveSheet.Range("A1").Activate
Set rng = .Range(.Cells(1, 1), .Cells(1, 1)).End(xlDown)
rng.Select
Exit For
Else
ActiveCell.Offset(1, 0).Activate
End If
Next
For Each cell In Columns
If ActiveCell.Offset(0, 0) = "A" Then
ActiveCell.Offset(0, 0) = "End of A"
Columns("A").Select
Selection.AutoFilter Field:=1, Criteria1:="=*of A*", Operator:=xlOr, _
Criteria2:="=A"
Exit Sub
Else
ActiveCell.Offset(-1, 0).Activate
End If
Next
End With
End Sub
Jim
"HBF" wrote:
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