So if your data were:
a
a
a
a
b
b
b
a
a
a
And you were on the second cell (the second a), you'd want to stop at the 4th
cell.
If that's the case, you could use a macro. You could assign the macro to a
shortcut key if you wanted, but I'd find it easier to rightclick and choose an
option.
If you want to try...
Create a new workbook (or maybe put it in your personal.xls* workbook???).
Option Explicit
Const myCaption As String = "Find Last In This Group Column"
Sub Auto_Open()
With Application.CommandBars("Cell")
On Error Resume Next
.Controls(myCaption).Delete
On Error GoTo 0
With .Controls.Add
.Caption = myCaption
.OnAction = "'" & ThisWorkbook.Name & "'!FindLastInGroup"
End With
End With
End Sub
Sub auto_close()
With Application.CommandBars("Cell")
On Error Resume Next
.Controls(myCaption).Delete
On Error GoTo 0
End With
End Sub
Sub FindLastInGroup()
If ActiveCell.Value = "" Then
'do nothing
Else
Application.ScreenUpdating = False
Do
If ActiveCell.Offset(1, 0).Value = ActiveCell.Value Then
If ActiveCell.Row = ActiveSheet.Rows.Count Then
Exit Do
Else
ActiveCell.Offset(1, 0).Activate
End If
Else
Exit Do
End If
Loop
Application.ScreenUpdating = True
End If
End Sub
Then save this workbook. Whenever you need this functionality, just reopen this
workbook.
You may want to add some other checks (no stopping on hidden rows????) -- or
anything else you can think of.
If you're new to macros:
Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html
David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm
(General, Regular and Standard modules all describe the same thing.)