Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Selecting sheets based on cell in each sheet

If I have a "Yes" or "No" in say cell A1 of each sheet in a workbook. Is
there a way to select each sheet that has a "Yes" in cell A1? There could be
up to 100 sheets in the workbook. Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting sheets based on cell in each sheet


This code will do what you ask


Code:
--------------------
Private Sub test()
Dim w As Worksheet
Dim ws() As String
Dim i As Integer

i = 0

For Each w In Worksheets
If UCase(w.Range("A1").Value) = "YES" Then
ReDim Preserve ws(i)
ws(i) = w.Name
i = i + 1
End If
Next w

Sheets(ws).Select

End Sub
--------------------


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=568108

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Selecting sheets based on cell in each sheet

Thank you very much, that worked perfectly.

"Excelenator" wrote:


This code will do what you ask


Code:
--------------------
Private Sub test()
Dim w As Worksheet
Dim ws() As String
Dim i As Integer

i = 0

For Each w In Worksheets
If UCase(w.Range("A1").Value) = "YES" Then
ReDim Preserve ws(i)
ws(i) = w.Name
i = i + 1
End If
Next w

Sheets(ws).Select

End Sub
--------------------


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=568108


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 a cell entry based on cell validation selection Brutalius Excel Worksheet Functions 2 December 17th 08 03:44 AM
selecting a single sheet from a volume of sheets in a workbook No News Excel Worksheet Functions 12 July 1st 06 05:29 AM
Selecting all sheets and sheet methods Patrick Seurre Excel Programming 3 January 10th 06 01:45 PM
Selecting Sheets based on Cell Criteria. Tim Richards Excel Programming 3 May 25th 05 12:28 AM
Selecting a sheet based on a cell wilcster Excel Programming 3 December 30th 04 05:05 PM


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