I am trying to start to automate this painful report that I do by hand
every monday, I kinda was noticing what manual steps I was doing and I
figure I try to automate some of it, maybe all of it with time :- )

So I wanted to do first is.

The excel sheet has 6 columns, A - F

A--------------B------------C
Date-----------Name---------Activity


D E and F have time and productivity data, but I only want to sort by A
first and then by B, this I already done, so Sort by Date, then by
Name. Then Look into column B and insert a 25 row space between the
Names if the are not the same..

Here is my VB code so far: the Sorting works (maybe there is a way to
shorten the code), but it works..

The insert 25 rows, doesn't work, so I am figuring there is something
wrong there, that's the part I need help with..


Sub FormatTablebyName()

' This one will sort the column A/B and then seperate by 25 rows column
B if name is not the same.

Dim iRow As Long
Dim lastRow As Long

lastRow = Range("A65536").End(xlUp).Row

Columns("A:F").Select
Range("F1").Activate

' Sort Column A ( Works )

Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

' Sort Column B ( Works )

Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

' Seperate Names in Column B with a 25 space row insert

For iRow = 1 To lastRow
If Cells(iRow, 2) <> Cells(iRow + 1, 2) Then
Rows(iRow + 25).Insert
lastRow = lastRow + 25
Row = iRow + 25
End If
Next iRow
End Sub

If I replace the 25 with a 1, it works perfectly for inserting the 1
row insert, but not with 25, what am I doing wrong, help this niewbie
out, thanks!