ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If active sheet and cell reference (https://www.excelbanter.com/excel-programming/412643-if-active-sheet-cell-reference.html)

iansmigger

If active sheet and cell reference
 
I am currently using the following code in This Workbook to prevent printing
a worksheet until all cells vave been completed:-

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("E3").Text = "COMPLETE" Then

And then it reformats the sheet before printing.

The problem I have is that it also prevents printing any other sheets within
the workbook if this sheet is not in a complete status in cell E3.

I would like to do something along the lines of the following but do not
know the code to make it work:-

If Activesheet="Supplier Request Form" AND Range("E3").Text =
"COMPLETE" Then

Cheers

iansmigger


Gary''s Student

If active sheet and cell reference
 
You are 97% there!
Instead of:

If Activesheet="Supplier Request Form".....

use:

If Activesheet.Name="Supplier Request Form".............
--
Gary''s Student - gsnu200792


"iansmigger" wrote:

I am currently using the following code in This Workbook to prevent printing
a worksheet until all cells vave been completed:-

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("E3").Text = "COMPLETE" Then

And then it reformats the sheet before printing.

The problem I have is that it also prevents printing any other sheets within
the workbook if this sheet is not in a complete status in cell E3.

I would like to do something along the lines of the following but do not
know the code to make it work:-

If Activesheet="Supplier Request Form" AND Range("E3").Text =
"COMPLETE" Then

Cheers

iansmigger



All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com