Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Hide columns in multiple sheets

I am using this code to hide columns on multiple sheets:

Sheets(Array("04-329", "04-350", "05-001", "05-353", "05-354",
"06-011", "06-012", _
"06-013")).Select
Sheets("04-329").Activate

Range("H:H,L:U").Select
Range("S1").Activate
Selection.EntireColumn.Hidden = True

It works on the first sheet, but only selects the columns in the
remainder and does not hide them. What do I need to change to hide the
selection on all the sheets. TIA

Greg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Hide columns in multiple sheets

I think I'd just cycle through those worksheets

dim wks as worksheet
for each wks in worksheets(Array("04-329", "04-350", "05-001", "05-353", _
"05-354", "06-011", "06-012", "06-013"))

wks.range("H:H,L:U").EntireColumn.Hidden = True
next wks

GregR wrote:

I am using this code to hide columns on multiple sheets:

Sheets(Array("04-329", "04-350", "05-001", "05-353", "05-354",
"06-011", "06-012", _
"06-013")).Select
Sheets("04-329").Activate

Range("H:H,L:U").Select
Range("S1").Activate
Selection.EntireColumn.Hidden = True

It works on the first sheet, but only selects the columns in the
remainder and does not hide them. What do I need to change to hide the
selection on all the sheets. TIA

Greg


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Hide columns in multiple sheets

Dave, thank you, got it working with:

Sheets(Array("04-329", "04-350", "05-001", "05-353", "05-354", _
"06-011", "06-012", "06-013")).Select
For Each Sht In ActiveWindow.SelectedSheets
Sht.Range("H1,L1:U1").EntireColumn.Hidden = True
Next Sht

Greg

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hide columns in multiple sheets

to prevent problems if you then edit a cell, you might want

Sheets(Array("04-329", "04-350", "05-001", "05-353", "05-354", _
"06-011", "06-012", "06-013")).Select
For Each Sht In ActiveWindow.SelectedSheets
Sht.Range("H1,L1:U1").EntireColumn.Hidden = True
Next Sht
sht.Select

to ungroup the sheets.

--
Regards,
Tom Ogilvy

"GregR" wrote in message
oups.com...
Dave, thank you, got it working with:

Sheets(Array("04-329", "04-350", "05-001", "05-353", "05-354", _
"06-011", "06-012", "06-013")).Select
For Each Sht In ActiveWindow.SelectedSheets
Sht.Range("H1,L1:U1").EntireColumn.Hidden = True
Next Sht

Greg



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Hide columns in multiple sheets

Tom, good suggestion, thanks

Greg



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
Add Columns in multiple Sheets Ken Excel Discussion (Misc queries) 4 April 30th 23 07:43 PM
Lookup across multiple columns within multiple sheets Garnet Excel Discussion (Misc queries) 2 June 25th 08 11:46 PM
Insert Columns in multiple sheets Needs Help Excel Worksheet Functions 3 January 24th 08 07:46 PM
Multiple Sheets and Columns Tom D[_2_] Excel Worksheet Functions 9 April 27th 07 06:42 PM
Show / Hide Columns in multiple sheets Shadster Excel Programming 2 June 27th 05 12:09 PM


All times are GMT +1. The time now is 12:29 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"