Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default List specific worksheets

I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default List specific worksheets

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("A1").Value Like "*Adrian* Then
'Add WS.Name to your list here
End If
Next WS

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default List specific worksheets

Dear Bernie,

Many thanks for the speedy response.

However, apologies for being dense, but I still have problems.

I'm using Excel 2003 (should have mentioned that at the start)

In a worksheet named "List Sheets" I have a command button which, when
clicked, should run the code you sent - putting the list on the same
worksheet starting from cell c2 (say) where I place the cursor

So, I have the following:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value Like ("Y") Then
'Add WS.Name '
End If
Next WS

End Sub

Where am I going wrong?

Again thanks
--
Adrian


"Bernie Deitrick" wrote:

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("A1").Value Like "*Adrian* Then
'Add WS.Name to your list here
End If
Next WS

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default List specific worksheets

Adrian,

You're not actually listing the sheets: that was code that I thought you had already developed.
Here is my take:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim i As Integer
Dim myR As Long
Dim myC As Integer

myR = ActiveCell.Row
myC = ActiveCell.Column

For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value = "Y" Then
Worksheets("List Sheets").Cells(myR, myC).Value = WS.Name
myR = myR + 1
End If
Next WS

End Sub

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
Dear Bernie,

Many thanks for the speedy response.

However, apologies for being dense, but I still have problems.

I'm using Excel 2003 (should have mentioned that at the start)

In a worksheet named "List Sheets" I have a command button which, when
clicked, should run the code you sent - putting the list on the same
worksheet starting from cell c2 (say) where I place the cursor

So, I have the following:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value Like ("Y") Then
'Add WS.Name '
End If
Next WS

End Sub

Where am I going wrong?

Again thanks
--
Adrian


"Bernie Deitrick" wrote:

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("A1").Value Like "*Adrian* Then
'Add WS.Name to your list here
End If
Next WS

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default List specific worksheets

Dear Bernie,

I'm grateful for all of your trouble. I tried your code and got:

run-time error '9'
subscript out of range

The debugger highlighted the line below "Then"

Sorry!
--
Adrian


"Bernie Deitrick" wrote:

Adrian,

You're not actually listing the sheets: that was code that I thought you had already developed.
Here is my take:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim i As Integer
Dim myR As Long
Dim myC As Integer

myR = ActiveCell.Row
myC = ActiveCell.Column

For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value = "Y" Then
Worksheets("List Sheets").Cells(myR, myC).Value = WS.Name
myR = myR + 1
End If
Next WS

End Sub

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
Dear Bernie,

Many thanks for the speedy response.

However, apologies for being dense, but I still have problems.

I'm using Excel 2003 (should have mentioned that at the start)

In a worksheet named "List Sheets" I have a command button which, when
clicked, should run the code you sent - putting the list on the same
worksheet starting from cell c2 (say) where I place the cursor

So, I have the following:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value Like ("Y") Then
'Add WS.Name '
End If
Next WS

End Sub

Where am I going wrong?

Again thanks
--
Adrian


"Bernie Deitrick" wrote:

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("A1").Value Like "*Adrian* Then
'Add WS.Name to your list here
End If
Next WS

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default List specific worksheets

Dear Bernie,

Ignore the last message - it works fine and I'm eternally grateful!

Many, Many thanks

Cheers

--
Adrian


"Adrian Bear" wrote:

Dear Bernie,

I'm grateful for all of your trouble. I tried your code and got:

run-time error '9'
subscript out of range

The debugger highlighted the line below "Then"

Sorry!
--
Adrian


"Bernie Deitrick" wrote:

Adrian,

You're not actually listing the sheets: that was code that I thought you had already developed.
Here is my take:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim i As Integer
Dim myR As Long
Dim myC As Integer

myR = ActiveCell.Row
myC = ActiveCell.Column

For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value = "Y" Then
Worksheets("List Sheets").Cells(myR, myC).Value = WS.Name
myR = myR + 1
End If
Next WS

End Sub

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
Dear Bernie,

Many thanks for the speedy response.

However, apologies for being dense, but I still have problems.

I'm using Excel 2003 (should have mentioned that at the start)

In a worksheet named "List Sheets" I have a command button which, when
clicked, should run the code you sent - putting the list on the same
worksheet starting from cell c2 (say) where I place the cursor

So, I have the following:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("B32").Value Like ("Y") Then
'Add WS.Name '
End If
Next WS

End Sub

Where am I going wrong?

Again thanks
--
Adrian


"Bernie Deitrick" wrote:

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Range("A1").Value Like "*Adrian* Then
'Add WS.Name to your list here
End If
Next WS

HTH,
Bernie
MS Excel MVP


"Adrian Bear" wrote in message
...
I can produce a list of ALL worksheets in a workbook. How can I produce a
list limited to, say, a specific text string in a particular cell in each
worksheet?

--
Adrian






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
How to load a list of web links into specific worksheets? Eric Excel Worksheet Functions 0 March 3rd 08 04:32 AM
How do I add specific categories from several worksheets? Crys H. Excel Worksheet Functions 5 July 31st 06 11:38 PM
if specific value from list A equals one of the values from list b... broer konijn Excel Worksheet Functions 7 June 14th 06 06:28 AM
Summing specific cells on two worksheets srpettew Excel Worksheet Functions 0 April 20th 06 07:52 PM
For Each wks In ActiveWorkbook.Worksheets bar a specific one? Pank Mehta Excel Discussion (Misc queries) 4 March 30th 05 04:53 PM


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