Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() In the before print event, I need code to execute only for a particula worksheet named "Checks" (code name Sheet2). I have tried th following as well as variations but can't get the if statement to wor properly: Private Sub Workbook_BeforePrint(Cancel As Boolean) If Active.Worksheets.Name = "Checks" Then (code goes here) Else (other code goes here) End If End Sub I'm trying to keep it simple. Any ideas? Thanks so very much mikebur -- mikebur ----------------------------------------------------------------------- mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458 View this thread: http://www.excelforum.com/showthread.php?threadid=46635 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
Try: Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Name = "Checks" Then MsgBox "Located" Else MsgBox "Not the sheet!" End If End Sub --- Regards, Norman "mikeburg" wrote in message ... In the before print event, I need code to execute only for a particular worksheet named "Checks" (code name Sheet2). I have tried the following as well as variations but can't get the if statement to work properly: Private Sub Workbook_BeforePrint(Cancel As Boolean) If Active.Worksheets.Name = "Checks" Then (code goes here) Else (other code goes here) End If End Sub I'm trying to keep it simple. Any ideas? Thanks so very much. mikeburg -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581 View this thread: http://www.excelforum.com/showthread...hreadid=466356 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You may want to just apply the code to both Checks and all the other worksheets,
too. Just because the worksheet isn't active, doesn't mean it's not being printed. mikeburg wrote: In the before print event, I need code to execute only for a particular worksheet named "Checks" (code name Sheet2). I have tried the following as well as variations but can't get the if statement to work properly: Private Sub Workbook_BeforePrint(Cancel As Boolean) If Active.Worksheets.Name = "Checks" Then (code goes here) Else (other code goes here) End If End Sub I'm trying to keep it simple. Any ideas? Thanks so very much. mikeburg -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581 View this thread: http://www.excelforum.com/showthread...hreadid=466356 -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks so very much. It's amazing when you are learning, sometimes th simplest problems are the hardest to remember! You are a life saver. mikebur -- mikebur ----------------------------------------------------------------------- mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458 View this thread: http://www.excelforum.com/showthread.php?threadid=46635 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statement syntax | Excel Discussion (Misc queries) | |||
if statement syntax help | Excel Worksheet Functions | |||
need help with syntax of if statement | Excel Worksheet Functions | |||
need help with syntax of a Workbook Event | Excel Programming |