Hi, I wonder whether someone may be able to help me please.
I'm using the code below to add multiple sheets to a workbook:
Sub NewSheets()
Dim shArray() As Variant 'Declare the sheet Name array and a
Dim i As Long 'counter variable
shArray = Array("BAS Consultants", _
"Monthly Direct", _
"Monthly Enhancements", _
"Monthly Indirect", _
"Monthly Overheads", _
"Monthly Projects", _
"Yearly Direct", _
"Yearly Enhancements", _
"Yearly Indirect", _
"Yearly Overheads", _
"Yearly Projects", _
"C&R In Flight Projects", _
"S&A In Flight Projects", _
"C&R Graph Data", _
"S&A Graph Data", _
"C&R Flexible Resource Profile", _
"S&S Flexible Resource Profile", _
"C&R Flexible Resource KPI", _
"C&R Resource Capacity") 'Populate the array
For i = LBound(shArray) To UBound(shArray) 'Loop through the elements
Sheets.Add(After:=Worksheets(1)).Name = shArray(i)
Next i
End Sub
The code works, but the issue I have is that the position of the sheets when the workbook has been built, doesn't reflect the order by which I've listed them in the code i.e. the "BAS Consultants" sheet becomes the last sheet in the workbook rather than the first.
Could someone possibly tell me please, is there a way to force the sheets to be created in the position by which they are set in the list above.
Many thanks and kind regards
Chris
Bookmarks