Thread: Delete Sheets
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jahsonn Jahsonn is offline
external usenet poster
 
Posts: 9
Default Delete Sheets

Hi Experts
The following code should open wb FNAME and then the
Delete sheet who's name is in cell G10 in worksheet
CONTROL. It opens the FNAME sheet but it is not deleting
sheet REMITID.

Can anyone help?

Sub Cleardown_Remit()

RemitID = Worksheets("Control").Range("G10").Value
fname = Worksheets("Control").Range("H10").Value

With Application
..ScreenUpdating = False
..DisplayAlerts = False
End With

Set oWb = Workbooks.Open(fname)
Worksheets(RemitID).Delete
oWb.Close

With Application
..ScreenUpdating = True
..DisplayAlerts = True
End With

End Sub