Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default referencing a sheet in VB

1) In VB, how do I list all sheet names on one worksheet?

2) In VB, how do I list all sheets that start with a similar name (e.g., QTD) on one worksheet

I'd really appreciate any and all help!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default referencing a sheet in VB

Mary Agnes

try these for ideas:

Sub ListWorksheets()
Dim ws As Worksheet
Dim i As Long
For Each ws In Worksheets
i = i + 1
Range("A" & i) = ws.Name
Next ws
End Sub

Sub ListWorksheetsQTD()
Dim ws As Worksheet
Dim i As Long
For Each ws In Worksheets
If UCase(Left(ws.Name, 3)) = "QTD" Then
i = i + 1
Range("A" & i) = ws.Name
End If
Next ws
End Sub

Regards

Trevor


"Mary Agnes" wrote in message
...
1) In VB, how do I list all sheet names on one worksheet?

2) In VB, how do I list all sheets that start with a similar name (e.g.,

QTD) on one worksheet?

I'd really appreciate any and all help!!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default referencing a sheet in VB

Mary,

Workbooks contain worksheets.

Sub test()
Dim wks As Worksheet, i As Long

i = 1
For Each wks In Worksheets
Sheet1.Cells(i, 1).Value = wks.Name
i = i + 1
Next
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Mary Agnes" wrote in message
...
1) In VB, how do I list all sheet names on one worksheet?

2) In VB, how do I list all sheets that start with a similar name (e.g.,

QTD) on one worksheet?

I'd really appreciate any and all help!!!!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default referencing a sheet in VB

Trevor & Rob:
Thanks so much for your help! I was able to combine both solutions into my program and it was EXACTLY what I was looking for.

Can you recommend a good reference book for using VB 6.0?
Thanks,
Mary Agnes :)
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
Sheet Referencing - autofilling sheet names Pat Excel Worksheet Functions 2 June 4th 09 03:50 AM
Referencing Cells on Another Sheet PAL Excel Worksheet Functions 0 January 23rd 08 12:38 AM
Referencing every 5th cell in another sheet [email protected] Excel Worksheet Functions 4 June 20th 07 02:49 PM
copy formula referencing sheet name to another sheet Tat Excel Worksheet Functions 1 June 26th 05 03:00 AM
referencing a sheet named in a cell then using data from that sheet gbeard Excel Worksheet Functions 4 April 15th 05 08:42 AM


All times are GMT +1. The time now is 10:20 PM.

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"