Control the insert of a new sheet.

Q

Question_123

Hi group,

I have searched this group already with no real defining answer to my
question. I have a macro that reads a sheet of infomation and creates
new sheets. Is there a way to control where the sheet is inserted. The
default is "before". I want it to show up "after". I have included
the code I use to create the additional worksheets. Any help would be
appreciated.

Sub Make_Reports()

Dim iReport As Long
Dim lRow As Long
Dim i As Integer
Dim wsReport As Worksheet
Dim wsData As Worksheet

iReport = 1
lRow = 1
Set wsData = ActiveSheet
Application.ScreenUpdating = False

Do While Not IsEmpty(wsData.Cells(lRow, 1))

'add new worksheet for new report
Set wsReport = Worksheets.Add
wsReport.Name = wsData.Cells(lRow, 2)

'copy data (26 rows * 9 columns)
wsData.Cells(lRow, 1).Resize(26, 9).Copy _
Destination:=wsReport.Range("A5")

'Increment Counter
lRow = lRow + 26

Loop

End Sub
 
T

Tom Ogilvy

Set wsReport = Worksheets.Add( After:=worksheets(worksheets.count))

as an example.
 
Top