Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Delete Sheets

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro-delete all sheets except puiuluipui Excel Discussion (Misc queries) 6 October 13th 09 05:49 AM
How do I delete Sheets if "Delete" is greyed out? carriemca Excel Discussion (Misc queries) 1 April 10th 06 05:31 PM
Delete Sheets SS[_3_] Excel Programming 2 February 5th 04 02:37 PM
Delete new sheets? ianripping[_27_] Excel Programming 1 January 17th 04 02:14 PM
select and delete sheets Locachica Excel Programming 5 December 31st 03 01:02 PM


All times are GMT +1. The time now is 03:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"