I have a Visual Basic macro I used to use to split a large worksheet with tens of thousands of records into multiples worksheets of n rows each. I upgraded to Office 2008 and lost the use of that macro.
Can someone help me figure out how to do it in Excel 2008?
Here is the old VB macro:
Public Sub SplitWorksheet()
Dim SourceWorksheet As Worksheet
Dim TargetWorksheet As Worksheet
Const RowsInEach = 4000
Set SourceWorksheet = ActiveSheet
Do While SourceWorksheet.UsedRange.Rows.Count > 1
Set TargetWorksheet = Sheets.Add
SourceWorksheet.Rows(1).Resize(RowsInEach + 1).Copy TargetWorksheet.Rows(1).Resize(RowsInEach + 1)
SourceWorksheet.Rows(1).Resize(RowsInEach).Offset(1).Delete
Loop
End Sub
Thanks for any advice!
Bookmarks