Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default selecting range over multiple sheets

Hi
I am trying to select a columns that are hidden in sheets 1-10 and then
unhide them.
Below is as far as I have gotten. Selecting the sheets and columns appears
to work fine, the problem appears to be in activating said cells in order to
unhide them in each sheet. The following code without the line
'Worksheets(Array.....)).Activate only unhides he columns on sheet1.

Sub Show()

'Show hidden outcome columns
Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")).Select
'Worksheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10")).Activate<<<problem

Columns("D:O").Select
Selection.EntireColumn.Hidden = False
Range("D5").Select


End Sub

If anyone can help I would appreciate it.

Cheers
Tanya
  #2   Report Post  
Posted to microsoft.public.excel.programming
HI HI is offline
external usenet poster
 
Posts: 5
Default selecting range over multiple sheets

How about this one.
Sub test()
Dim Sh As Worksheet
Set area = Sheets(Array(2, 3, 4)) /*You can use your selection
here*/
For Each Sh In area
Sh.Select
Range("P:P,O:O,E:E").Select /*Also use your selection here too*/
Selection.EntireColumn.Hidden = False
Next Sh
End Sub


On 7 joulu, 14:08, Tanya wrote:
Hi
I am trying to select a columns that are hidden in sheets 1-10 and then
unhide them.
Below is as far as I have gotten. Selecting the sheets and columns appears
to work fine, the problem appears to be in activating said cells in order to
unhide them in each sheet. The following code without the line
'Worksheets(Array.....)).Activate only unhides he columns on sheet1.

Sub Show()

'Show hidden outcome columns
Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")).Select
'Worksheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10")).Activate<<<problem

Columns("D:O").Select
Selection.EntireColumn.Hidden = False
Range("D5").Select

End Sub

If anyone can help I would appreciate it.

Cheers
Tanya


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default selecting range over multiple sheets

Thank you HI

Your procedure worked and I amended it as follows so that after the columns
are visible I return to sheet 'Setup'

Sub Show()
Dim ws As Worksheet
Set area = Sheets(Array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11))
For Each ws In area
ws.Select
Columns("D:O").Select
Selection.EntireColumn.Hidden = False
Next ws
Sheets("Setup").Activate
End Sub

Kind Regards
Tanya
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default selecting range over multiple sheets

Tanya: You shouldn't need to use a For loop to iterate through all of the
worksheets unhiding the columns. Select all of the sheets and unhide the
columns at once, just like you would if you record the code using the macro
recorder. Try the following code:

Worksheets(Array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).Select

With Worksheets(2)
.Activate
.Columns("D:O").Hidden = False
.Range("A1").Select

'Ungroup the worksheets.
.Select
End With

Sheets("Setup").Activate

--
Regards,
Bill Renaud



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
Selecting Multiple Sheets in VBA Gizmo63 Excel Worksheet Functions 4 May 8th 06 01:50 PM
selecting multiple sheets Shaun Excel Worksheet Functions 1 August 31st 05 04:09 PM
selecting multiple sheets Dennis Excel Programming 2 January 1st 04 08:06 PM
selecting multiple sheets Young-Hwan Choi Excel Programming 2 November 24th 03 01:19 AM
Changing the value in multiple sheets without selecting those sheets herm Excel Programming 3 October 14th 03 03:50 PM


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