How do I copy each row from 1 Worksheet to separate Worksheets?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Worksheets(1) row 26 contains Headers
Worksheets(1) row 27 to row 282 contains data
How do I copy each row to a separate worksheet automatically?
 
Dandelo

This code will take the headers in A26:H26 (extend if you need more width)
of the data worksheet and then each row below to 282 will become the only
line below the header on a new sheet, with the next row making another new
sheet, so the model ends up with the original data sheet and 256 others,
each containing the headers in A1:H1 and one row of data in A2:H2. The
sheet tab is named with the row of the data it contains and is placed to the
right of the last one added

Hope I understood... (place this in a standard module and your data sheet
must be the first sheet in the workbook, or you will need to change the
worksheets(1) to Worksheets("NameOfYourDataSheet"))

Sub MoveData()
Dim wksData As Worksheet
Dim wksNew As Worksheet
Dim x As Long
Dim vHeaders As Variant
Set wksData = Worksheets(1)
vHeaders = wksData.Range("A26:H26").Value
x = 27
For x = 27 To 282
Set wksNew = Worksheets.Add(, Worksheets(Worksheets.Count))
wksNew.Name = "Row " & x & " Data"
wksNew.Range("A1:H1").Value = vHeaders
wksData.Range("A" & x & ":H" & x).Copy Destination:=wksNew.Range("A2")
Set wksNew = Nothing
Next x
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)
 
No problem, thanks for coming back to say thank you :-) doesn't happen that
much now :-(

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top