VBA IF FUNCTIONS WITH PRINT RANGE

  • Thread starter Thread starter Hamed parhizkar
  • Start date Start date
H

Hamed parhizkar

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top