Arrays, & Worksheets & Grey Hair
Hello All..
I am trying to get this thing to function..without much success.
What it needs to do is..
Only insert one new sheet on request (called from another macro/userform)
Check if that sheet already exists, then insert the next one from the array
where the sheet names are stored.
Here's the code so far..(It just spits out all the sheets in the array in
one go)
Sub Newsheets()
Dim nLast As Long
Dim i As Long
Dim NewSheet
Dim n As Long
Dim a As Long
NewSheet = Array("31-60", "61-90", "91-120", "121-150")
For n = LBound(NewSheet) To UBound(NewSheet)
nLast = Sheets.Count
For i = 1 To ActiveWindow.SelectedSheets.Count
Sheets.Add _
After:=Sheets(Sheets.Count), _
Type:= _
"C:\Documents and Settings\Admin\Application
Data\Microsoft\Templates\New Sheet.XLT"
Sheets("sheet1").Name = NewSheet(n)
Count = 1
Sheets(nLast + 1).Select
Next i
Add_Numbers
Next n
End Sub
Any thoughts on where to go from here are indeed welcomed.
Regards
Peter
|