ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA IF FUNCTIONS WITH PRINT RANGE (https://www.excelbanter.com/excel-programming/409017-vba-if-functions-print-range.html)

Hamed parhizkar

VBA IF FUNCTIONS WITH PRINT RANGE
 
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

Shane Devenshire

VBA IF FUNCTIONS WITH PRINT RANGE
 
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



Hamed parhizkar

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





All times are GMT +1. The time now is 01:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com