VBA IF QUESTION
It should look like this...
If Range("C28") 0 Then
Range("A23:D34").Select
ActiveSheet.PageSetup.PrintArea = "$A$23:$D$34"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
Whenever you have multiple statements that, as a group, will only be
executed for a given logical condition, you put all the multiple statements
between an If-Then statement (with nothing following the Then) and an End If
statement.
Rick
"Hamed parhizkar" wrote in
message ...
So what is the formula suppose to look like, I dont have a _ in there?
If Range("C28") 0 Then Range("A23:D34").Select
ActiveSheet.PageSetup.PrintArea = "$A$23:$D$34"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
"Joel" wrote:
Don't put the continuation line after the then. I caught the mistake
just
when I press the reply button as the window was closing.
from
then _
to
then
"Hamed parhizkar" wrote:
I have this formula in vba:
If Range("C28") 0 Then Range("A23:D34").Select
ActiveSheet.PageSetup.PrintArea = "$A$23:$D$34"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
It works fine and prints but it prints even if the cell is zero. What
am I
doing wrong. I only need it to print the range if c28 is greater than
zero.
Please help.
|