Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Selecting all sheets

Hi Erin

You need a loop

Sub test1()
Dim Arr() As String
Dim N As Long
Dim Sh
N = 0
For Each Sh In ThisWorkbook.Sheets
If Sh.Visible = True Then
N = N + 1
ReDim Preserve Arr(1 To N)
Arr(N) = Sh.Name
End If
Next Sh
ThisWorkbook.Sheets(Arr).Select
End Sub


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


"Erin" wrote in message ...
I need a piece of VBA code that will select all visible sheets. When I record a macro, it does it via an array and specifying

each sheet name. But, in my case I don't know how many sheets there are.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Selecting all sheets

Thanks, works perfectly!
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 sheets - II Dr.Schwartz Excel Discussion (Misc queries) 4 July 25th 05 02:31 PM
Selecting all sheets Don Guillett[_4_] Excel Programming 0 May 10th 04 06:38 PM
Selecting sheets without specifying abxy[_47_] Excel Programming 1 April 8th 04 12:51 AM
Changing the value in multiple sheets without selecting those sheets herm Excel Programming 3 October 14th 03 03:50 PM
selecting sheets jacqui[_2_] Excel Programming 0 September 11th 03 02:46 PM


All times are GMT +1. The time now is 08:02 AM.

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"