LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Printing If Cell Empty

There isn't a separate msgbox function and and msgbox statement.

Just for clarity

There is only a msgbox function. If you choose not to use the returned
value, you don't put the arguments in parentheses (unless you preface it
with call). This is a VBA syntax rule.

All these work. All use the msgbox function

Sub AB()
MsgBox "First Fill In The Name", vbOKCancel
Call MsgBox("First Fill In The Name", vbOKCancel)
ans = MsgBox("First Fill In The Name", vbOKCancel)
End Sub

Just to cover all the bases, this will work
MsgBox ("First Fill In the Name")

but the parentheses around a single argument are interpreted for a different
purpose. They cause the argument to be evaluated - essentially forcing a
byVal argument.


--
Regards,
Tom Ogilvy

"moon" <6369706865725F6475646540706C616E65742E6E6C wrote in message
. ..

A Range or a Cell can not be True or False, only the value that's in
there.
Print #1 is being used when writing data to a file, for a worksheet you'll
need PrintOut.
Try it again, but then referencing the cell-address instead of the range.

'Row 4, Column 2 = B4
If ActiveSheet.Cells(4, 2).Value < Empty Then
ActiveSheet.PrintOut
End If




"Rob" schreef in bericht
...
It still doesn't work.

If ActiveSheet.Range("B40") = False Or "" Then

Print #1,

End If

I don't know... It's got to be something.

"moon" wrote:


Because the 'value' is always True, even if it's an empty value.
So...

If Application.ActiveSheet.Range("B40").Value < Empty Then
ActiveSheet.PrintOut
End If



"Rob" schreef in bericht
...
Ahhhh sweet. I tried your suggestion but it still prints.

"moon" wrote:

It means 'almost I guess'.
I'm just confusing newsgroups, that's all :-o



"Rob" schreef in bericht
...
Ummmm... What?

"moon" wrote:


Bijna... Denk ik.


If Application.ActiveSheet.Range("B40").Value = True Then
ActiveSheet.PrintOut
End If

"Rob" schreef in bericht
...
I'm wondering if there is a way to disable the ability to print
unless
cell
B40 is < FALSE, Something like this...


Sub ThisWorkbook_Print()

If Application.ActiveSheet.Range("B40").Value = False Then
Application.ActivePrinter = Nothing
End If

End Sub

I was hoping that the above code I made might do it but it
doesn't
seem
to
work.

Any Ideas?

Thanks In Advance,
Rob













 
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
How do I disable the advanced printing features permanently? Dolores Excel Discussion (Misc queries) 2 January 17th 10 06:42 PM
How to disable printing a specific worksheet? Efzed Excel Worksheet Functions 1 February 21st 07 05:43 PM
How to disable printing a specific worksheet? William Horton Excel Worksheet Functions 0 February 21st 07 02:12 PM
Printing gridlines with empty cell nickjohn Excel Discussion (Misc queries) 2 May 6th 06 07:57 PM
Disable Printing JOHN SMITH Excel Discussion (Misc queries) 2 April 14th 05 01:00 AM


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