View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Hamed parhizkar Hamed parhizkar is offline
external usenet poster
 
Posts: 45
Default VBA IF FUNCTIONS WITH PRINT RANGE

Here is what I have in and it worked but the tables that were zero still
printed??? What am I doing wrong???

If Range("C28") 0 Then Range("A23:D34").Select
ActiveSheet.PageSetup.PrintArea = "$A$23:$D$34"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

"Shane Devenshire" wrote:

the basic code would be:

IF Range("table1") 0 then
.... (place the code necessary to print the range here)
End IF

In this example table1 represents the cell where the value of the first
table is found. you could replace this with Range("A1")

Cheers,
Shane

"Hamed parhizkar" wrote in
message ...
I have a sheet that has 16 different tables. Each table has 1 value, it is
either zero, or a number greater than zero. If it is greater than zero
then I
need the table or tables to print out. I am familiar with macros and
buttons,
but how do I do the if function and print range through vba. I can send
the
spreadsheet for better understanding if you need me to.


thanks,

Hamed Parhizkar