LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Mark
 
Posts: n/a
Default Private sub

I have the following running under a command button.
it works once and then the next time an error appears on
the following line under Sh

For Each Sh In wb.Worksheets



Private Sub CommandButton1_Click()
Dim wb As Workbook
'copy all sheets
Worksheets.Copy
Set wb = ActiveWorkbook
Application.DisplayAlerts = False
'delete the sheets you want
wb.Sheets(Array("Suspense", "RCA exc RIM", "Operations
summary", "RCA incl RIM", "First Qtr", "Second
Qtr", "Third Qtr", "Fourth Qtr")).Delete
Application.DisplayAlerts = True

For Each Sh In wb.Worksheets
Sh.Columns("A:B").EntireColumn.Delete
Next
End Sub

Any help please

Mark
 
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
Default view of Excel to 75% Gaurav Excel Discussion (Misc queries) 10 August 4th 07 11:54 PM
Userform - Printing Greg B Excel Worksheet Functions 9 September 16th 05 12:11 AM
Macro to simply bring up the Find dialogue box?? marika1981 Excel Discussion (Misc queries) 14 January 14th 05 10:47 PM
Data Entry Alert in User Form Kev Excel Discussion (Misc queries) 6 January 8th 05 03:01 PM
Check boxes to show/hide Tabs Sridhar Rao Excel Worksheet Functions 1 January 5th 05 03:28 PM


All times are GMT +1. The time now is 10:21 PM.

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"