N
Nigel Bennett
I would like to delete all the spreadsheets in a workbook
(except three menu, summary and blank) and then add new
spreadsheets based on the values in a range. I need to
know how to delete all the workbooks in the spreadsheet
and then recreate them, here is the code I am trying to
create the new spreadsheets
THe values for the new spreadsheets are in a sheet called
summary starting at row 5 in column A
Dim cell As Range, Rng As Range
Dim sh As Worksheet
With Worksheets("summary")
Set Rng = .Range(.Cells(5, 1), .Cells(5, 1).End(xlDown))
End With
For Each cell In Rng
Set sh = Worksheets(cell.Value)
MsgBox sh
Dim mysheet As String
Range("A1") = sh
mysheet = Sheets("Menu").Range("A1")
Dim oWs As Worksheet
Dim oOLE As OLEObject
If mysheet = "SRP2" Then Exit Sub
MsgBox mysheet
'Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name
= Worksheets("summary").Range("A1")
Sheets("Blank").Activate
Sheets("Blank").Copy(After:=Worksheets
(Worksheets.Count)).Name = Worksheets("summary").Range
("A1")
(except three menu, summary and blank) and then add new
spreadsheets based on the values in a range. I need to
know how to delete all the workbooks in the spreadsheet
and then recreate them, here is the code I am trying to
create the new spreadsheets
THe values for the new spreadsheets are in a sheet called
summary starting at row 5 in column A
Dim cell As Range, Rng As Range
Dim sh As Worksheet
With Worksheets("summary")
Set Rng = .Range(.Cells(5, 1), .Cells(5, 1).End(xlDown))
End With
For Each cell In Rng
Set sh = Worksheets(cell.Value)
MsgBox sh
Dim mysheet As String
Range("A1") = sh
mysheet = Sheets("Menu").Range("A1")
Dim oWs As Worksheet
Dim oOLE As OLEObject
If mysheet = "SRP2" Then Exit Sub
MsgBox mysheet
'Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name
= Worksheets("summary").Range("A1")
Sheets("Blank").Activate
Sheets("Blank").Copy(After:=Worksheets
(Worksheets.Count)).Name = Worksheets("summary").Range
("A1")