Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Is there an object containing the sheet names for a workbook

Hi,
here's the problem.
I have worksheets containing the same kind of data and would like to
consolidate data from the sheet with some restrictions. And I would like
construct some sort of macro for this task since it will be repeated quite
often. But the set of sheets in the workbook will probeably change over time.
Is there a method for finding the names of the sheets in an workbook so that
a could loop over the existing sheets?

/Niklas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Is there an object containing the sheet names for a workbook

Sub saysheet()
For Each sh In Worksheets
MsgBox (sh.Name)
Next
End Sub

--
Gary''s Student - gsnu200741


"Niklas M" wrote:

Hi,
here's the problem.
I have worksheets containing the same kind of data and would like to
consolidate data from the sheet with some restrictions. And I would like
construct some sort of macro for this task since it will be repeated quite
often. But the set of sheets in the workbook will probeably change over time.
Is there a method for finding the names of the sheets in an workbook so that
a could loop over the existing sheets?

/Niklas

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Is there an object containing the sheet names for a workbook

There is also Worksheets.Count that tells you how many worksheets, or
Sheets.Count that tells you the number of sheets (worksheets, charts, etc.)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Gary''s Student" wrote in message
...
Sub saysheet()
For Each sh In Worksheets
MsgBox (sh.Name)
Next
End Sub

--
Gary''s Student - gsnu200741


"Niklas M" wrote:

Hi,
here's the problem.
I have worksheets containing the same kind of data and would like to
consolidate data from the sheet with some restrictions. And I would like
construct some sort of macro for this task since it will be repeated
quite
often. But the set of sheets in the workbook will probeably change over
time.
Is there a method for finding the names of the sheets in an workbook so
that
a could loop over the existing sheets?

/Niklas



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
Iterating Through Workbook if Don't Know Sheet Names wrldruler Excel Programming 3 June 15th 07 03:17 PM
View All Sheet Names in Workbook at Once Lincoln Excel Discussion (Misc queries) 2 May 7th 07 11:17 PM
Using Sheet names & Workbook names in VBA coding Colin Foster[_5_] Excel Programming 5 July 7th 06 07:04 PM
Retrieving the sheet names of another workbook Aidy[_2_] Excel Programming 1 June 25th 04 07:29 PM


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