Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try changing the lines set oWb = Workbooks.Open(fname) Worksheets(RemitID).Delete oWb.Close to set oWb = Workbooks.Open(fname) oWb.Worksheets(RemitID).Delete oWb.save oWb.Close -----Original Message----- 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro-delete all sheets except | Excel Discussion (Misc queries) | |||
How do I delete Sheets if "Delete" is greyed out? | Excel Discussion (Misc queries) | |||
Delete Sheets | Excel Programming | |||
Delete new sheets? | Excel Programming | |||
select and delete sheets | Excel Programming |