Get an error 91. Im trying to delete worksheets in a workbook name. Worksheet names are in column Z of a particular sheet.
Object variable or With block variable not set (Error 91)
Code below
Sub finaldelsheets()
Dim Ws As Worksheet
Dim c As Range
'deletes analysis sheets that are selected at start of process
Application.DisplayAlerts = False
For Each c In Ws("Africa").Range("z1:z4").Cells
Sheets(c.Value).Delete
Next c
Application.DisplayAlerts = True
End Sub
Object variable or With block variable not set (Error 91)
Code below
Sub finaldelsheets()
Dim Ws As Worksheet
Dim c As Range
'deletes analysis sheets that are selected at start of process
Application.DisplayAlerts = False
For Each c In Ws("Africa").Range("z1:z4").Cells
Sheets(c.Value).Delete
Next c
Application.DisplayAlerts = True
End Sub