Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Judy Ward
 
Posts: n/a
Default Define list of worksheets

I have an excel file with a dozen worksheets. I can run my Delete_Columns
function on all of the worksheets with this command:

Dim wks As Object
For Each wks In Worksheets
wks.Activate
Delete_Columns
Next wks

My problem is that I want to run this function on all the worksheets except
one ("History"). Is there a way to either exclude one worksheet or to define
the list of worksheets (IR_5, IR_6, IR_6_1, IR_7, IR_8, IR_9, IR_10, IR_11,
IR_any, IR_TBD, Doc_Only)?

Thank you for any help you can give me,
Judy
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Try this Judy

Dim wks As Object
For Each wks In Worksheets
If wks.Name < "History" Then
wks.Activate
Delete_Columns
End If
Next wks


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Judy Ward" wrote in message ...
I have an excel file with a dozen worksheets. I can run my Delete_Columns
function on all of the worksheets with this command:

Dim wks As Object
For Each wks In Worksheets
wks.Activate
Delete_Columns
Next wks

My problem is that I want to run this function on all the worksheets except
one ("History"). Is there a way to either exclude one worksheet or to define
the list of worksheets (IR_5, IR_6, IR_6_1, IR_7, IR_8, IR_9, IR_10, IR_11,
IR_any, IR_TBD, Doc_Only)?

Thank you for any help you can give me,
Judy



  #3   Report Post  
bj
 
Posts: n/a
Default

try

Dim wks As Object
For Each wks In Worksheets
wks.Activate
if wks.name<"History" then Delete_Columns
Next wks

"Judy Ward" wrote:

I have an excel file with a dozen worksheets. I can run my Delete_Columns
function on all of the worksheets with this command:

Dim wks As Object
For Each wks In Worksheets
wks.Activate
Delete_Columns
Next wks

My problem is that I want to run this function on all the worksheets except
one ("History"). Is there a way to either exclude one worksheet or to define
the list of worksheets (IR_5, IR_6, IR_6_1, IR_7, IR_8, IR_9, IR_10, IR_11,
IR_any, IR_TBD, Doc_Only)?

Thank you for any help you can give me,
Judy

  #4   Report Post  
Ron Coderre
 
Posts: n/a
Default

If you just want to exclude the "History" worksheet:

Dim wks As Object
For Each wks In Worksheets
if wks.Name < "History" Then
wks.Activate
Delete_Columns
End If
Next wks

Does that help?

--
Regards,
Ron

  #5   Report Post  
Judy Ward
 
Posts: n/a
Default

Thank you all very much for your quick responses. This is exactly what I
needed.

"Judy Ward" wrote:

I have an excel file with a dozen worksheets. I can run my Delete_Columns
function on all of the worksheets with this command:

Dim wks As Object
For Each wks In Worksheets
wks.Activate
Delete_Columns
Next wks

My problem is that I want to run this function on all the worksheets except
one ("History"). Is there a way to either exclude one worksheet or to define
the list of worksheets (IR_5, IR_6, IR_6_1, IR_7, IR_8, IR_9, IR_10, IR_11,
IR_any, IR_TBD, Doc_Only)?

Thank you for any help you can give me,
Judy

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
how do i link a list of items in a workbook to worksheets in the . Camalla Excel Discussion (Misc queries) 2 April 22nd 05 09:35 PM
Linking Drop-down list to worksheets Compnerd Excel Discussion (Misc queries) 0 March 7th 05 06:13 PM
Extracting data from multiple worksheets into a list mnirula Excel Worksheet Functions 16 February 25th 05 08:52 PM
list values equal in 2 worksheets? NEVA LOCKETT Excel Worksheet Functions 2 February 23rd 05 03:21 PM
List of Worksheets in a work book Bottle Excel Worksheet Functions 2 December 8th 04 12:17 PM


All times are GMT +1. The time now is 01:28 PM.

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

About Us

"It's about Microsoft Excel"