Hi
Is it possible to print a worksheet if a cell has a value?
I have 7 worksheets and want the print macro to only print those that contain data in a particular cell.
Any ideas would be really appreciated.
Steven811
Hi
Is it possible to print a worksheet if a cell has a value?
I have 7 worksheets and want the print macro to only print those that contain data in a particular cell.
Any ideas would be really appreciated.
Steven811
Last edited by Steven811; 05-02-2010 at 06:45 AM.
Somethig like
Please Login or Register to view this content.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Thanks for that but, I can't get it to work and I think I haven't explained it very clearly.
My aim is to have a macro that looks in cell K66 for example and if it contains "1" it will print Sheet 1, then it looks in K67 for "2" and it will then print Sheet 2, if there is no value in the cell then that particular page does not print, this will run for any combination of the 7 worksheets.
Your initial description ...
... reads as if there is an individual cell in each worksheet that determines whether or not the sheet should be printed.I have 7 worksheets and want the print macro to only print those that contain data in a particular cell.
Please make sure to state your requirements in full and precisely to avoid wasting time.
That's nothing like your initial request. If you use 1 for print & 0 for no print then
Please Login or Register to view this content.
Thank you for your assistance.
I apologise for my poorly written thread
I forget to say that when you use the code change PrintPreview to PrintOut
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
How to mark a thread Solved
Go to the first post
Click edit
Click Go Advanced
Just below the word Title you will see a dropdown with the word No prefix.
Change to Solved
Click Save
Last edited by royUK; 05-01-2010 at 07:18 AM.
I'm afraid that this is clearly beyond my very limited vba abilities, I'm getting a compile error "invalid inside procedure" and am unclear how to proceed.
My code now looks like:
Please Login or Register to view this content.
You have placed all the example code within your button. This will only work if you use 1 to print & zero to not print in the cells
Please Login or Register to view this content.
Hi Roy, thanks for that, I think I'm nearly there.
For some reason it prints Sheet 1 to 4 and not to Sheet 7 as well as printing Sheet 3 where I've set the value at 0, the rest are set at 1. I've checked the cell contents and they appear to be identical. Can I also exclude a specific worksheet?
The sheets are printing according to the order they are in the workbook
I've attached the workbook. The print button is on the machine logo costs sheet which is also the only worksheet that I do not wish to print.
So why not simply exclude that sheet? If you want touse the list on the sheet
Please Login or Register to view this content.
Hi Roy, brilliant!
You can't believe what a relief that is, it works perfectly.
I need something similar to this code. But the cells the code checks has a formular that returns a number. If that number is higher than zero it should print the sheet, if it is zero it shouldn´t. As it is now the code will print the sheet as long as there is a formular in the cell, no matter what the cell returns.
Any suggestions?
Possibly change
toPlease Login or Register to view this content.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks