Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Hi,
Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Maybe
for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Hi KC
Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
That is a pseudo code, not actual code.
The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Maybe...
Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Hi Dave, I have added a few things based on needs, can you please look it over? Will check code tonight. Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 And _ If .Cells(iRow,"F").Value < "NOT BALANCED !" Then <----------Syntax Correct? .Cells(Row, "A").Resize(52, 9).PrintOut preview:=True <----------from colun A to I (9 columns) Else Msgbx "Printing is Disabled Until All Batches Balanced." , vbOkayOnly <--Syntax Correct ? End If Next iRow End With End Sub "Dave Peterson" wrote in message ... Maybe... Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
The best way to debug your code is to do the work yourself. You'll find your
typos (Row instead of iRow, vbOkayOnly, msgbox....) After you try to debug your version, try this version: Option Explicit Sub testme() Dim iRow As Long With ActiveSheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 _ And UCase(.Cells(iRow, "F").Value) < UCase("NOT BALANCED !") Then .Cells(iRow, "A").Resize(52, 9).PrintOut preview:=True Else MsgBox "Printing is Disabled Until All Batches Balanced.", vbOKOnly End If Next iRow End With End Sub Did you really mean to include that space before the exclamation point? Gerard Sanchez wrote: Hi Dave, I have added a few things based on needs, can you please look it over? Will check code tonight. Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 And _ If .Cells(iRow,"F").Value < "NOT BALANCED !" Then <----------Syntax Correct? .Cells(Row, "A").Resize(52, 9).PrintOut preview:=True <----------from colun A to I (9 columns) Else Msgbx "Printing is Disabled Until All Batches Balanced." , vbOkayOnly <--Syntax Correct ? End If Next iRow End With End Sub "Dave Peterson" wrote in message ... Maybe... Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson -- Dave Peterson |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Hi Dave, I just finished testing, few things though, Horizontally page 1 starts from Row 18 to Row 69 Vertically from Column A to I. All 25 pages are 52 rows, 6 columns each The cell that determines whether the page 2 gets printed is at row F65. Cell that determines whether page 3 gets printed is at F117, page 4 at F169 and on . . . Current code prints from Row 65 and repeats every 52 pages. (My fault wasn't clear with my desc) Also, is there a way where we can do just one message box when value is "NOT BALANCED !" and Equal to zero. Because currently message box displays for all pages that are not printed due to conditons. i.e., if 4 active pages, 4 messages box comes up one after the other. Yes, there is an extra space before the exclamation. Thanks "Dave Peterson" wrote in message ... The best way to debug your code is to do the work yourself. You'll find your typos (Row instead of iRow, vbOkayOnly, msgbox....) After you try to debug your version, try this version: Option Explicit Sub testme() Dim iRow As Long With ActiveSheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 _ And UCase(.Cells(iRow, "F").Value) < UCase("NOT BALANCED !") Then .Cells(iRow, "A").Resize(52, 9).PrintOut preview:=True Else MsgBox "Printing is Disabled Until All Batches Balanced.", vbOKOnly End If Next iRow End With End Sub Did you really mean to include that space before the exclamation point? Gerard Sanchez wrote: Hi Dave, I have added a few things based on needs, can you please look it over? Will check code tonight. Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 And _ If .Cells(iRow,"F").Value < "NOT BALANCED !" Then <----------Syntax Correct? .Cells(Row, "A").Resize(52, 9).PrintOut preview:=True <----------from colun A to I (9 columns) Else Msgbx "Printing is Disabled Until All Batches Balanced." , vbOkayOnly <--Syntax Correct ? End If Next iRow End With End Sub "Dave Peterson" wrote in message ... Maybe... Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson -- Dave Peterson |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Hi Dave,
Had to edit above post. Sorry. I just finished testing, few things though, Horizontally page 1 starts from Row 18 to Row 69 Vertically from Column A to I. All 25 pages are 52 rows, 6 columns each The cell that determines whether the page 1 gets printed is at row F65. Cell that determines whether page 2 gets printed is at F117, page 4 at F169 and on . . . Current code prints from Row 65 and repeats every 52 pages. Which cuts the active page. Also, is there a way where we can do just one message box when value is "NOT BALANCED !" and Equal to zero. Because currently message box displays for all pages that are not printed due to conditons. i.e., if 4 active pages, 4 messages box comes up one after the other. Yes, there is an extra space before the exclamation. Thanks "Gerard Sanchez" wrote in message ... Hi Dave, I just finished testing, few things though, Horizontally page 1 starts from Row 18 to Row 69 Vertically from Column A to I. All 25 pages are 52 rows, 6 columns each The cell that determines whether the page 2 gets printed is at row F65. Cell that determines whether page 3 gets printed is at F117, page 4 at F169 and on . . . Current code prints from Row 65 and repeats every 52 pages. (My fault wasn't clear with my desc) Also, is there a way where we can do just one message box when value is "NOT BALANCED !" and Equal to zero. Because currently message box displays for all pages that are not printed due to conditons. i.e., if 4 active pages, 4 messages box comes up one after the other. Yes, there is an extra space before the exclamation. Thanks "Dave Peterson" wrote in message ... The best way to debug your code is to do the work yourself. You'll find your typos (Row instead of iRow, vbOkayOnly, msgbox....) After you try to debug your version, try this version: Option Explicit Sub testme() Dim iRow As Long With ActiveSheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 _ And UCase(.Cells(iRow, "F").Value) < UCase("NOT BALANCED !") Then .Cells(iRow, "A").Resize(52, 9).PrintOut preview:=True Else MsgBox "Printing is Disabled Until All Batches Balanced.", vbOKOnly End If Next iRow End With End Sub Did you really mean to include that space before the exclamation point? Gerard Sanchez wrote: Hi Dave, I have added a few things based on needs, can you please look it over? Will check code tonight. Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 And _ If .Cells(iRow,"F").Value < "NOT BALANCED !" Then <----------Syntax Correct? .Cells(Row, "A").Resize(52, 9).PrintOut preview:=True <----------from colun A to I (9 columns) Else Msgbx "Printing is Disabled Until All Batches Balanced." , vbOkayOnly <--Syntax Correct ? End If Next iRow End With End Sub "Dave Peterson" wrote in message ... Maybe... Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson -- Dave Peterson |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Print Active Pages in the Worksheet
Option Explicit
Sub testme() Dim iRow As Long With ActiveSheet 'loop once to validate F65, F117, ... For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 _ And UCase(.Cells(iRow, "F").Value) < UCase("NOT BALANCED !") Then 'do nothing Else MsgBox "Printing is Disabled Until All Batches Balanced.", _ vbOKOnly Exit Sub End If Next iRow 'loop a second time to do the real work For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! 'no need to check again .Cells(iRow, "A").Offset(iRow - 47, 0).Resize(52, 9).PrintOut _ preview:=True Next iRow End With End Sub Gerard Sanchez wrote: Hi Dave, Had to edit above post. Sorry. I just finished testing, few things though, Horizontally page 1 starts from Row 18 to Row 69 Vertically from Column A to I. All 25 pages are 52 rows, 6 columns each The cell that determines whether the page 1 gets printed is at row F65. Cell that determines whether page 2 gets printed is at F117, page 4 at F169 and on . . . Current code prints from Row 65 and repeats every 52 pages. Which cuts the active page. Also, is there a way where we can do just one message box when value is "NOT BALANCED !" and Equal to zero. Because currently message box displays for all pages that are not printed due to conditons. i.e., if 4 active pages, 4 messages box comes up one after the other. Yes, there is an extra space before the exclamation. Thanks "Gerard Sanchez" wrote in message ... Hi Dave, I just finished testing, few things though, Horizontally page 1 starts from Row 18 to Row 69 Vertically from Column A to I. All 25 pages are 52 rows, 6 columns each The cell that determines whether the page 2 gets printed is at row F65. Cell that determines whether page 3 gets printed is at F117, page 4 at F169 and on . . . Current code prints from Row 65 and repeats every 52 pages. (My fault wasn't clear with my desc) Also, is there a way where we can do just one message box when value is "NOT BALANCED !" and Equal to zero. Because currently message box displays for all pages that are not printed due to conditons. i.e., if 4 active pages, 4 messages box comes up one after the other. Yes, there is an extra space before the exclamation. Thanks "Dave Peterson" wrote in message ... The best way to debug your code is to do the work yourself. You'll find your typos (Row instead of iRow, vbOkayOnly, msgbox....) After you try to debug your version, try this version: Option Explicit Sub testme() Dim iRow As Long With ActiveSheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 _ And UCase(.Cells(iRow, "F").Value) < UCase("NOT BALANCED !") Then .Cells(iRow, "A").Resize(52, 9).PrintOut preview:=True Else MsgBox "Printing is Disabled Until All Batches Balanced.", vbOKOnly End If Next iRow End With End Sub Did you really mean to include that space before the exclamation point? Gerard Sanchez wrote: Hi Dave, I have added a few things based on needs, can you please look it over? Will check code tonight. Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 And _ If .Cells(iRow,"F").Value < "NOT BALANCED !" Then <----------Syntax Correct? .Cells(Row, "A").Resize(52, 9).PrintOut preview:=True <----------from colun A to I (9 columns) Else Msgbx "Printing is Disabled Until All Batches Balanced." , vbOkayOnly <--Syntax Correct ? End If Next iRow End With End Sub "Dave Peterson" wrote in message ... Maybe... Option Explicit Sub testme() Dim iRow As Long with Activesheet For iRow = 65 To 169 Step 52 'change 169 to 1261 when you're ready! If .Cells(iRow, "F").Value < 0 Then .Cells(Row, "A").Resize(52, 99).PrintOut preview:=True End If Next iRow End With End Sub I assumed that the start of the page is column A of that same row as the one being checked. And you want to print 99 columns. You'll have to change that or at least share how to determine both those things. And I did a print preview to save paper when you're testing. And I used row 169 as my last check--change that when you're ready to try it for real. Gerard Sanchez wrote: Can anybody help?? "KC" wrote in message ... That is a pseudo code, not actual code. The macro recorder can help you. "Gerard Sanchez" wrote in message ... Hi KC Just tested the code as shown and I got a syntax error? Sub PrintActivePages() For i = 65 To 1261 Step 52 If Range("F" & i) < 0 Then set print range to rows (i, i+51) <--------syntax error here PrintOut End If Next i End Sub "KC" wrote in message ... Maybe for i=65 to 1261 step 52 if range("F" & i)<0 then set print range to rows (i, i+51) printout end if next i "Gerard Sanchez" wrote in message ... Hi, Each worksheet has 25 pages in it. Some have values some don't. I was wondering if anybody cen help me with a Module Level Macro that lets me print pages provided a cell on that page is not equal to zero (0) Here it is: Print page two if F65 < 0 Print page three if F117 < 0 Print page four if F169 < 0 Print page five if F221 < 0 and on . . . until page 25 if cell F1261 < 0 (pattern is every 52 cells beginning with F65 and ending with F1261) Anybody?? -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Number of pages in worksheet doesn't match Print Preview pages | Excel Discussion (Misc queries) | |||
how do you print 2 pages per worksheet | Excel Discussion (Misc queries) | |||
how do you print 2 pages per worksheet | Excel Discussion (Misc queries) | |||
need a print macro to print only a certain number of pages | Excel Discussion (Misc queries) | |||
Code to print most (not all) pages within active workbook | Excel Programming |