enter blank rows

  • Thread starter Thread starter Greg Malenky
  • Start date Start date
G

Greg Malenky

excel 2000

need a formula to enter a blank row after a number of
entries. However, the number of entries varies with a
maximum number of 10 employees for each store.

I've tried countif and row() functions but can't seem to
come up with the right answer.

employee store
john store 1
bill store 1
kevin store 1
brian store 2
joe store 2
tim store 3
tony store 3
fred store 3
jane store 4
michelle store 4

I need the output to look like this:

john store 1
bill store 1
kevin store 1

brian store 2
joe store 2

tim store 3
tony store 3
fred store 3

jane store 4
michelle store 4

totals all stores

thanks,
greg
 
Try (In a Standard Module):

Sub InsertRow_OnB_Chg()
Dim irow As Long, vcurrent As String, i As Long
'// find last used cell in Column B
irow = Cells(Rows.Count, "B").End(xlUp).Row
'// get value of that cell in Column B (column 2)
vcurrent = Cells(irow, 2).Value
'// rows are inserted by looping from bottom
For i = irow To 2 Step -1
If Cells(i, 2).Value <> vcurrent Then
vcurrent = Cells(i, 2).Value
Rows(i + 1).Insert
End If
Next i
End Sub
 
Back
Top