Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default VBA solution for printing specific pages

Can anyone help me with the following, please?

I have an Excel workbook in which the first page is a summary or index
sheet, containing hyperlinks to each of the subsequent sheets.

I'd like to be able to allow those to whom I am distributing it the option
of printing a predetermined selection of those sheets, based on the whether
or not a specific cell in those sheets contains a specified value.

For example, sheets no's 1, 4 & 6 all contain a specific value in cell L6;
I'd like users to be able to click on a macro on the summary page and for the
macro to locate and print a copy of sheet no's 1, 4 & 6 before returning the
user to the summary page. The values in cell L6 may change, although they
should never deviate from a range of options chosen from a drop-down list.

As such, what I am after is a macro or some VBA code that will search for
each page where that value occurs in cell L6 and prints that page, rather
than a more simple macro that directs users to a pre-defined list of pages,
seeing as these may change.

Is this possible at all? I'm trying to build some future-proofing of sorts
into this workbook so that the macros or code don't need rewriting each time
there is a variation to the value in cell L6 on any of the sheets.

Any suggestions greatly appreciated.

Thanks,

Dickie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default VBA solution for printing specific pages

Hi,

Sub demo()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("L6").Value = "WhateverYouWant" Then
ws.PrintOut
End If
Next ws

End Sub

Should do it, or at least give you the right idea

"Dickie Worton" wrote:

Can anyone help me with the following, please?

I have an Excel workbook in which the first page is a summary or index
sheet, containing hyperlinks to each of the subsequent sheets.

I'd like to be able to allow those to whom I am distributing it the option
of printing a predetermined selection of those sheets, based on the whether
or not a specific cell in those sheets contains a specified value.

For example, sheets no's 1, 4 & 6 all contain a specific value in cell L6;
I'd like users to be able to click on a macro on the summary page and for the
macro to locate and print a copy of sheet no's 1, 4 & 6 before returning the
user to the summary page. The values in cell L6 may change, although they
should never deviate from a range of options chosen from a drop-down list.

As such, what I am after is a macro or some VBA code that will search for
each page where that value occurs in cell L6 and prints that page, rather
than a more simple macro that directs users to a pre-defined list of pages,
seeing as these may change.

Is this possible at all? I'm trying to build some future-proofing of sorts
into this workbook so that the macros or code don't need rewriting each time
there is a variation to the value in cell L6 on any of the sheets.

Any suggestions greatly appreciated.

Thanks,

Dickie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default VBA solution for printing specific pages

Hi Sam,

Looks simple enough, I'm a fairly limited VBA programmer but will give it a
go and let you know how I get on.

Thanks for the speedy reply, very much appreciated.

Dickie

"Sam Wilson" wrote:

Hi,

Sub demo()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("L6").Value = "WhateverYouWant" Then
ws.PrintOut
End If
Next ws

End Sub

Should do it, or at least give you the right idea

"Dickie Worton" wrote:

Can anyone help me with the following, please?

I have an Excel workbook in which the first page is a summary or index
sheet, containing hyperlinks to each of the subsequent sheets.

I'd like to be able to allow those to whom I am distributing it the option
of printing a predetermined selection of those sheets, based on the whether
or not a specific cell in those sheets contains a specified value.

For example, sheets no's 1, 4 & 6 all contain a specific value in cell L6;
I'd like users to be able to click on a macro on the summary page and for the
macro to locate and print a copy of sheet no's 1, 4 & 6 before returning the
user to the summary page. The values in cell L6 may change, although they
should never deviate from a range of options chosen from a drop-down list.

As such, what I am after is a macro or some VBA code that will search for
each page where that value occurs in cell L6 and prints that page, rather
than a more simple macro that directs users to a pre-defined list of pages,
seeing as these may change.

Is this possible at all? I'm trying to build some future-proofing of sorts
into this workbook so that the macros or code don't need rewriting each time
there is a variation to the value in cell L6 on any of the sheets.

Any suggestions greatly appreciated.

Thanks,

Dickie

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default VBA solution for printing specific pages

Sam,

Thanks again, I have tried this out and it works like a charm. I've been
able to adapt it to cover several different options, particularly useful as
there are over 50 sheets in the workbook and the last thing I wanted was for
people to simply print them all to get the 10 or so they needed.

Much obliged to you!

Dickie

"Dickie Worton" wrote:

Hi Sam,

Looks simple enough, I'm a fairly limited VBA programmer but will give it a
go and let you know how I get on.

Thanks for the speedy reply, very much appreciated.

Dickie

"Sam Wilson" wrote:

Hi,

Sub demo()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("L6").Value = "WhateverYouWant" Then
ws.PrintOut
End If
Next ws

End Sub

Should do it, or at least give you the right idea

"Dickie Worton" wrote:

Can anyone help me with the following, please?

I have an Excel workbook in which the first page is a summary or index
sheet, containing hyperlinks to each of the subsequent sheets.

I'd like to be able to allow those to whom I am distributing it the option
of printing a predetermined selection of those sheets, based on the whether
or not a specific cell in those sheets contains a specified value.

For example, sheets no's 1, 4 & 6 all contain a specific value in cell L6;
I'd like users to be able to click on a macro on the summary page and for the
macro to locate and print a copy of sheet no's 1, 4 & 6 before returning the
user to the summary page. The values in cell L6 may change, although they
should never deviate from a range of options chosen from a drop-down list.

As such, what I am after is a macro or some VBA code that will search for
each page where that value occurs in cell L6 and prints that page, rather
than a more simple macro that directs users to a pre-defined list of pages,
seeing as these may change.

Is this possible at all? I'm trying to build some future-proofing of sorts
into this workbook so that the macros or code don't need rewriting each time
there is a variation to the value in cell L6 on any of the sheets.

Any suggestions greatly appreciated.

Thanks,

Dickie

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
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Printing solution Andreas Excel Programming 3 August 3rd 07 05:35 PM
How do I delete pages in Excel? Keeps printing blank pages at end. Jojobean Charts and Charting in Excel 1 May 31st 07 07:37 AM
Looking for solution on Printing multiple sheets Little Penny Excel Programming 1 August 22nd 06 04:57 AM
Printing specific pages rhani111[_2_] Excel Programming 9 February 20th 06 01:25 PM


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