View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default loop selecting data

Try the below macro with data in Sheet1.....should copy 297 records to new
sheets until end of data

Sub CopySplitSheet()
Dim intLoop As Integer
Dim lngLastRow As Long
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook
Do
intLoop = intLoop + 1
..Sheets("Sheet1").Range((intLoop - 1) * 2 + 1 & ":" & (intLoop * 2)).Copy
Sheets.Add
..ActiveSheet.Paste
Loop Until (intLoop * 2) = lngLastRow
End With
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"meggie" wrote:


I am trying to sort out a large piece of data.
I want the macro to copy the first 297 rows copy and paste this on a new
sheet.
I then want it to be able to loop this however skip the first 297 rows and
copy the next 297 and copy this into a new sheet.

I am new to VBA and am struggling to get this to run, any help would be
fantastic.