Need help modifying a macro

D

dave

Hi. I have a maco that works of a master sheet and creates a new
worksheet for every block of 25 records.

FirstSheetname = ActiveSheet.Name
Lastrow = Range(Cells(1, 1), Cells(Rows.Count, 1)).End(xlDown).Row
For i = 2 To Lastrow Step 25
NewSheetName = Sheets(FirstSheetname). _
Range("C1").Offset(rowoffset:=i - 1, columnoffset:=0) + "-"
NewSheetName = NewSheetName + Sheets(FirstSheetname).Range("C25"). _
Offset(rowoffset:=i - 1, columnoffset:=0)
Sheets.Add
ActiveSheet.Name = NewSheetName
Sheets(FirstSheetname).Rows("1:1").Copy _
Destination:=Worksheets(NewSheetName).Range("A1")
Sheets(FirstSheetname).Rows("1:25"). _
Offset(rowoffset:=i - 1, columnoffset:=0).Copy _
Destination:=Worksheets(NewSheetName).Range("A2")

I would like to change this so that a new worksheet is created that
has all rows where the data in column B is the same (data is alredy in
order by column B).

Any ideas?

Thanks.
 
K

Ken Snell \(MVP\)

This looks like an EXCEL question. You should post your question in an EXCEL
newsgroup. This newsgroup is for ACCESS.
 

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

Top