Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Selecting multiple tabs in VB

I have a spreadsheet with about ten different tabs. I am writing a macro
that will print all of these tabs that have data in them. I can write an if
statement asking if the total doesn't equal 0 then print. When I do this
each tab is printed out one at a time. This won't alow the page numbers in
the footer to work and in our office printing these tabs separately can cause
problem at the printer - since many people are using the printer at once.

What I don't know how to write is to "select a workgroup" (select multiple
tabs at once) of tabs that totals don't equal zero.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Selecting multiple tabs in VB

You can select several sheets at once with something like:

Sheets(Array("Sheet1", "Sheet2")).Select
--
Gary''s Student - gsnu200761


"Shawn777" wrote:

I have a spreadsheet with about ten different tabs. I am writing a macro
that will print all of these tabs that have data in them. I can write an if
statement asking if the total doesn't equal 0 then print. When I do this
each tab is printed out one at a time. This won't alow the page numbers in
the footer to work and in our office printing these tabs separately can cause
problem at the printer - since many people are using the printer at once.

What I don't know how to write is to "select a workgroup" (select multiple
tabs at once) of tabs that totals don't equal zero.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Selecting multiple tabs in VB

Thanks, that helps. But I don't want to tell the macro which sheets to
select, I want the marco to figure that out itself. Even the number of sheet
to print will change from job to job. Some could print just one of the ten
and others will print all ten. So can I get one name to equal
("Sheet1,","Sheet2")? Or is there a better way of doing this?

"Gary''s Student" wrote:

You can select several sheets at once with something like:

Sheets(Array("Sheet1", "Sheet2")).Select
--
Gary''s Student - gsnu200761


"Shawn777" wrote:

I have a spreadsheet with about ten different tabs. I am writing a macro
that will print all of these tabs that have data in them. I can write an if
statement asking if the total doesn't equal 0 then print. When I do this
each tab is printed out one at a time. This won't alow the page numbers in
the footer to work and in our office printing these tabs separately can cause
problem at the printer - since many people are using the printer at once.

What I don't know how to write is to "select a workgroup" (select multiple
tabs at once) of tabs that totals don't equal zero.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Selecting multiple tabs in VB

Dawn
Something like this will loop through all the sheets in the workbook. I
put in an IF statement to check some value in each sheet and if the criteria
is met, your code will run. Post back if you need more. HTH Otto
Sub DoEachSht()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("C10").Value 10 Then
'Your code here
End If
Next ws
End Sub
"Shawn777" wrote in message
...
Thanks, that helps. But I don't want to tell the macro which sheets to
select, I want the marco to figure that out itself. Even the number of
sheet
to print will change from job to job. Some could print just one of the
ten
and others will print all ten. So can I get one name to equal
("Sheet1,","Sheet2")? Or is there a better way of doing this?

"Gary''s Student" wrote:

You can select several sheets at once with something like:

Sheets(Array("Sheet1", "Sheet2")).Select
--
Gary''s Student - gsnu200761


"Shawn777" wrote:

I have a spreadsheet with about ten different tabs. I am writing a
macro
that will print all of these tabs that have data in them. I can write
an if
statement asking if the total doesn't equal 0 then print. When I do
this
each tab is printed out one at a time. This won't alow the page
numbers in
the footer to work and in our office printing these tabs separately can
cause
problem at the printer - since many people are using the printer at
once.

What I don't know how to write is to "select a workgroup" (select
multiple
tabs at once) of tabs that totals don't equal zero.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Selecting multiple tabs in VB

Yes, this is how I have it now. In the ['Your code here] section I have it
print. I need it to add it to the [Sheets(Array("Sheet1", "Sheet2")).Select]
in Gary's Student's reply. Then I can print the whole workbook at once -
which is what I want done.

So how do I combine Otto's and Gary's Student's help?


"Otto Moehrbach" wrote:

Dawn
Something like this will loop through all the sheets in the workbook. I
put in an IF statement to check some value in each sheet and if the criteria
is met, your code will run. Post back if you need more. HTH Otto
Sub DoEachSht()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("C10").Value 10 Then
'Your code here
End If
Next ws
End Sub
"Shawn777" wrote in message
...
Thanks, that helps. But I don't want to tell the macro which sheets to
select, I want the marco to figure that out itself. Even the number of
sheet
to print will change from job to job. Some could print just one of the
ten
and others will print all ten. So can I get one name to equal
("Sheet1,","Sheet2")? Or is there a better way of doing this?

"Gary''s Student" wrote:

You can select several sheets at once with something like:

Sheets(Array("Sheet1", "Sheet2")).Select
--
Gary''s Student - gsnu200761


"Shawn777" wrote:

I have a spreadsheet with about ten different tabs. I am writing a
macro
that will print all of these tabs that have data in them. I can write
an if
statement asking if the total doesn't equal 0 then print. When I do
this
each tab is printed out one at a time. This won't alow the page
numbers in
the footer to work and in our office printing these tabs separately can
cause
problem at the printer - since many people are using the printer at
once.

What I don't know how to write is to "select a workgroup" (select
multiple
tabs at once) of tabs that totals don't equal zero.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Selecting multiple tabs in VB

Shawn
I don't understand what you want that the code I gave you doesn't do.
With the code I gave you, you can do whatever you want with each sheet in
the workbook. Perhaps you have some sheets that you want to exclude from
the "Your code here" part. If that's the case, you can easily exclude
individual sheets with an IF statement like:
If ws.Name<"This" Or
ws.Name<"That" Or
ws.Name<"The Other" Then
'Your code here"
End If
Post back with more detail about what you want that this code doesn't do for
you. HTH Otto
"Shawn777" wrote in message
...
Yes, this is how I have it now. In the ['Your code here] section I have
it
print. I need it to add it to the [Sheets(Array("Sheet1",
"Sheet2")).Select]
in Gary's Student's reply. Then I can print the whole workbook at once -
which is what I want done.

So how do I combine Otto's and Gary's Student's help?


"Otto Moehrbach" wrote:

Dawn
Something like this will loop through all the sheets in the workbook.
I
put in an IF statement to check some value in each sheet and if the
criteria
is met, your code will run. Post back if you need more. HTH Otto
Sub DoEachSht()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("C10").Value 10 Then
'Your code here
End If
Next ws
End Sub
"Shawn777" wrote in message
...
Thanks, that helps. But I don't want to tell the macro which sheets to
select, I want the marco to figure that out itself. Even the number of
sheet
to print will change from job to job. Some could print just one of the
ten
and others will print all ten. So can I get one name to equal
("Sheet1,","Sheet2")? Or is there a better way of doing this?

"Gary''s Student" wrote:

You can select several sheets at once with something like:

Sheets(Array("Sheet1", "Sheet2")).Select
--
Gary''s Student - gsnu200761


"Shawn777" wrote:

I have a spreadsheet with about ten different tabs. I am writing a
macro
that will print all of these tabs that have data in them. I can
write
an if
statement asking if the total doesn't equal 0 then print. When I do
this
each tab is printed out one at a time. This won't alow the page
numbers in
the footer to work and in our office printing these tabs separately
can
cause
problem at the printer - since many people are using the printer at
once.

What I don't know how to write is to "select a workgroup" (select
multiple
tabs at once) of tabs that totals don't equal zero.






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
Selecting Page Tabs Millington Excel Discussion (Misc queries) 2 August 29th 07 08:24 PM
Selecting tabs in a multipage form CSUS_CE_Student[_2_] Excel Programming 1 August 27th 07 07:24 PM
selecting spreadsheet using tabs? Hoyos Excel Discussion (Misc queries) 0 December 1st 06 10:19 PM
selecting multiple sheet tabs and open another workbook Bannor Excel Discussion (Misc queries) 5 November 25th 05 02:38 AM
Selecting a group of sheet tabs Conan Kelly Excel Programming 1 November 15th 04 03:25 AM


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