Hi guys,
Trying select a range from a point x in a column to the the last empty cell above it.
I think I need another variable to count how many rows I have gone down but can't get my head quite around how to achieve this.
As you can see in the sample book i am trying to quickly fill in the above rows in the column.
![]()
Sub group_counter() Dim myrange As Range Dim n As Integer, mycounter As Integer, IntCounter As Integer Set myrange = ActiveSheet.Range("A2", Range("A" & Rows.Count).End(xlUp)) n = 1 IntCounter = myrange.Rows.Count - 1 myrange.Select For mycounter = 0 To IntCounter If (myrange(mycounter + 1).Value = myrange(mycounter + 2).Value) And _ (myrange(mycounter + 1).Offset(0, 9).Value <> myrange(mycounter + 2).Offset(0, 9).Value) Then n = n + 1 ElseIf myrange(mycounter + 1).Value <> myrange(mycounter + 2).Value Then myrange(mycounter + 1).Offset(0, 3) = n 'Range(Cells(mycounter + 1, "D"), x, "D").End(xlUp)).Select 'selection.valule = n n = 1 End If Next End Sub
Thanks in advance for your time and help!
D











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks