Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default CODE 2 SELECT SHEETS LISTED IN A RANGE

What code would select sheets that are named in the range: Sheet1!A1:A10
ignoring blanks cells, if any?

Thanx in advance.
--
Best Regards,

Faraz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default CODE 2 SELECT SHEETS LISTED IN A RANGE

give this a try

Sub select_sheets()
Dim ws As Worksheet
Dim cell As Range
Set ws = Worksheets("Sheet1")
For Each cell In ws.Range("A1:A10")
On Error Resume Next
If cell.Value "" Then
Worksheets(cell.Value).Select False
End If
On Error GoTo 0
Next
End Sub


--

Gary Keramidas
Excel 2003


"Faraz A. Qureshi" wrote in
message ...
What code would select sheets that are named in the range: Sheet1!A1:A10
ignoring blanks cells, if any?

Thanx in advance.
--
Best Regards,

Faraz


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default CODE 2 SELECT SHEETS LISTED IN A RANGE

Thanx Gary,

However, the code keeps the already active sheet to remain in the selected
one.
--
Best Regards,

Faraz


"Gary Keramidas" wrote:

give this a try

Sub select_sheets()
Dim ws As Worksheet
Dim cell As Range
Set ws = Worksheets("Sheet1")
For Each cell In ws.Range("A1:A10")
On Error Resume Next
If cell.Value "" Then
Worksheets(cell.Value).Select False
End If
On Error GoTo 0
Next
End Sub


--

Gary Keramidas
Excel 2003


"Faraz A. Qureshi" wrote in
message ...
What code would select sheets that are named in the range: Sheet1!A1:A10
ignoring blanks cells, if any?

Thanx in advance.
--
Best Regards,

Faraz



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default CODE 2 SELECT SHEETS LISTED IN A RANGE

kind of late here, so i'll just make this simple addition to the code

Sub select_sheets()
Dim wsname As String
Dim ws As Worksheet
Dim cell As Range
Dim cntr As Long
cntr = 0
wsname = ActiveSheet.Name
Set ws = Worksheets("Sheet1")
For Each cell In ws.Range("A1:A10")
On Error Resume Next
If cell.Value "" Then
If cntr = 0 Then
Worksheets(cell.Value).Select
cntr = cntr + 1
ElseIf cell.Value "" Then
Worksheets(cell.Value).Select False
End If
End If
On Error GoTo 0
Next
End Sub


--

Gary Keramidas
Excel 2003


"Faraz A. Qureshi" wrote in
message ...
Thanx Gary,

However, the code keeps the already active sheet to remain in the selected
one.
--
Best Regards,

Faraz


"Gary Keramidas" wrote:

give this a try

Sub select_sheets()
Dim ws As Worksheet
Dim cell As Range
Set ws = Worksheets("Sheet1")
For Each cell In ws.Range("A1:A10")
On Error Resume Next
If cell.Value "" Then
Worksheets(cell.Value).Select False
End If
On Error GoTo 0
Next
End Sub


--

Gary Keramidas
Excel 2003


"Faraz A. Qureshi" wrote in
message ...
What code would select sheets that are named in the range:
Sheet1!A1:A10
ignoring blanks cells, if any?

Thanx in advance.
--
Best Regards,

Faraz




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default CODE 2 SELECT SHEETS LISTED IN A RANGE

On Error Resume Next
With WorkSheets("Sheet1")
.Activate
.Range("A1:A10").SpecialCells(xlCellTypeConstants, 23).Select
End With




"Faraz A. Qureshi" a écrit dans le message de
groupe de discussion : ...
What code would select sheets that are named in the range: Sheet1!A1:A10
ignoring blanks cells, if any?

Thanx in advance.
--
Best Regards,

Faraz

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
CODE 2 SELECT SHEETS LISTED IN A RANGE Faraz A. Qureshi Excel Discussion (Misc queries) 1 July 30th 09 07:31 AM
How to select a listed item? Eric Excel Worksheet Functions 3 August 11th 07 02:20 AM
How to select a listed item? Eric Excel Discussion (Misc queries) 1 August 10th 07 05:26 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM


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