Thread: VBA IF QUESTION
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default VBA IF QUESTION

when you have code on the same line as the THEN it is the only part of the
code that is checked



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

"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.