Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Loop across Sheets and number of sheets

Dear all,

I request you all to kindly help me with this problem.

We maintain the details of a certain project in one
sheet. One sheet is devoted to only one project wherein
it contains information of the revenue, profitability,
vendors etc. For reporting purposes, for eg. if I have to
find out the status of all the vendors. Then I have to go
through each sheet and find it out.

I wish to create a macro which runs a loop (for, while,
do-while) across the sheets. Can anyone suggest how to
create a loop to cover the sheets. Secondly, is there any
command in VB Editor which can count the total number of
sheets in a file.

Thanking in advance,
Regards
Raj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Loop across Sheets and number of sheets


msgbox "There are " & Activework.Worksheets.Count & _
" sheets"

(example 1)
Dim ThisWS As Worksheet
For Each ThisWS In ActiveWorkbook.Worksheets

Next

(example 2)
Dim index As Long
For index = 1 To ActiveWorkbook.Worksheets.Count

Next


Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Dear all,

I request you all to kindly help me with this problem.

We maintain the details of a certain project in one
sheet. One sheet is devoted to only one project wherein
it contains information of the revenue, profitability,
vendors etc. For reporting purposes, for eg. if I have

to
find out the status of all the vendors. Then I have to

go
through each sheet and find it out.

I wish to create a macro which runs a loop (for, while,
do-while) across the sheets. Can anyone suggest how to
create a loop to cover the sheets. Secondly, is there

any
command in VB Editor which can count the total number of
sheets in a file.

Thanking in advance,
Regards
Raj
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Loop across Sheets and number of sheets

Hi Patrick,

Thanks a lot for the prompt response. I shall definitely
try this and come back in case I face any problems

Raj
-----Original Message-----

msgbox "There are " & Activework.Worksheets.Count & _
" sheets"

(example 1)
Dim ThisWS As Worksheet
For Each ThisWS In ActiveWorkbook.Worksheets

Next

(example 2)
Dim index As Long
For index = 1 To ActiveWorkbook.Worksheets.Count

Next


Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Dear all,

I request you all to kindly help me with this problem.

We maintain the details of a certain project in one
sheet. One sheet is devoted to only one project wherein
it contains information of the revenue, profitability,
vendors etc. For reporting purposes, for eg. if I have

to
find out the status of all the vendors. Then I have to

go
through each sheet and find it out.

I wish to create a macro which runs a loop (for, while,
do-while) across the sheets. Can anyone suggest how to
create a loop to cover the sheets. Secondly, is there

any
command in VB Editor which can count the total number

of
sheets in a file.

Thanking in advance,
Regards
Raj
.

.

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
Loop all Sheets not working. Pank New Users to Excel 12 February 27th 07 11:55 AM
Loop through varible list of sheets [email protected] Excel Discussion (Misc queries) 2 January 5th 07 08:45 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
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
Loop through sheets, deselect charts Daniel Bonallack[_2_] Excel Programming 4 October 28th 03 07:27 PM


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