View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
mrice
 
Posts: n/a
Default Code to create atbs in excel sheet


To create your new workbook with three sheets you can use

Sub Test()
Workbooks.Add
If ActiveWorkbook.Sheets.Count < 3 Then
For N = 1 To 3 - ActiveWorkbook.Sheets.Count
Sheets.Add
Next N
ElseIf ActiveWorkbook.Sheets.Count 3 Then
Application.DisplayAlerts = False
For N = 1 To ActiveWorkbook.Sheets.Count - 3
Sheets(1).Delete
Next N
Application.DisplayAlerts = True
End If
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=545774