Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Print area based on item list

I have an item list on on my first work sheet and several other worksheets
with invoices based on the first worksheet. How can I get the invoices to
print but only print the item lines with a greater than zero quantity?
--
Peter J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print area based on item list

Hi Peter

You can loop like this to Hide_Print_Unhide or use AutoFilter
This example look in the cells Sheets("Sheet1").Range("A1:A30")

Sub Hide_Print_Unhide()
Dim cell As Range
Dim rng As Range

Application.ScreenUpdating = False

With Sheets("Sheet1")
Set rng = .Range("A1:A30")

For Each cell In rng
If .Cells(cell.Row, 1).Value = 0 Then _
.Rows(cell.Row).Hidden = True
Next cell
.PrintOut ' for testing use .PrintPreview
rng.EntireRow.Hidden = False
End With

Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter J" wrote in message ...
I have an item list on on my first work sheet and several other worksheets
with invoices based on the first worksheet. How can I get the invoices to
print but only print the item lines with a greater than zero quantity?
--
Peter J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Print area based on item list

Hi ron

I tried it and no result. I'll try to explain what i want again. I have an
invoice design on a worksheet. Column A is Quantity "Col B"= Size "Col
C"=unit price and "Col D"= Total.
Rows 7:108 are all item lines. I need that when an Item line has a quantity
of zero the line does not print
I am no good at programming so walk me through it
--
Peter J


"Ron de Bruin" wrote:

Hi Peter

You can loop like this to Hide_Print_Unhide or use AutoFilter
This example look in the cells Sheets("Sheet1").Range("A1:A30")

Sub Hide_Print_Unhide()
Dim cell As Range
Dim rng As Range

Application.ScreenUpdating = False

With Sheets("Sheet1")
Set rng = .Range("A1:A30")

For Each cell In rng
If .Cells(cell.Row, 1).Value = 0 Then _
.Rows(cell.Row).Hidden = True
Next cell
.PrintOut ' for testing use .PrintPreview
rng.EntireRow.Hidden = False
End With

Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter J" wrote in message ...
I have an item list on on my first work sheet and several other worksheets
with invoices based on the first worksheet. How can I get the invoices to
print but only print the item lines with a greater than zero quantity?
--
Peter J




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print area based on item list

Hi peter

This is working if the cells display a zero 0
I they are empty you can use
If cell.Value = "" Then _

Note the sheet name is "Sheet1"


Sub Hide_Print_Unhide_2()
Dim cell As Range
Dim rng As Range

Application.ScreenUpdating = False

With Sheets("Sheet1")
Set rng = .Range("A7:A108")

For Each cell In rng
If cell.Value = 0 Then _
.Rows(cell.Row).Hidden = True
Next cell

.PrintOut ' for testing use .PrintPreview
rng.EntireRow.Hidden = False
End With

Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter J" wrote in message ...
Hi ron

I tried it and no result. I'll try to explain what i want again. I have an
invoice design on a worksheet. Column A is Quantity "Col B"= Size "Col
C"=unit price and "Col D"= Total.
Rows 7:108 are all item lines. I need that when an Item line has a quantity
of zero the line does not print
I am no good at programming so walk me through it
--
Peter J


"Ron de Bruin" wrote:

Hi Peter

You can loop like this to Hide_Print_Unhide or use AutoFilter
This example look in the cells Sheets("Sheet1").Range("A1:A30")

Sub Hide_Print_Unhide()
Dim cell As Range
Dim rng As Range

Application.ScreenUpdating = False

With Sheets("Sheet1")
Set rng = .Range("A1:A30")

For Each cell In rng
If .Cells(cell.Row, 1).Value = 0 Then _
.Rows(cell.Row).Hidden = True
Next cell
.PrintOut ' for testing use .PrintPreview
rng.EntireRow.Hidden = False
End With

Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter J" wrote in message ...
I have an item list on on my first work sheet and several other worksheets
with invoices based on the first worksheet. How can I get the invoices to
print but only print the item lines with a greater than zero quantity?
--
Peter J






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Print area based on item list

Hi Ron

Work great. Thanks alot.

Perhaps you can help me with the next arising problem which is I need all
the info which is at the bottom of the invoice ( Starting at row 40) to
remain there and not move up and down the page when the number of printable
items changes.

--
Peter J




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print area based on item list

You can make the text in the rows the same color as the backround
This example make the text white and print and make them black again

Sub Hide_Print_Unhide_3()
Dim cell As Range
Dim rng As Range

Application.ScreenUpdating = False

With Sheets("Sheet1")
Set rng = .Range("A7:A108")

For Each cell In rng
If cell.Value = 0 Then _
.Rows(cell.Row).Font.ColorIndex = 2
Next cell

.PrintOut ' for testing use .PrintPreview
rng.EntireRow.Font.ColorIndex = 1
End With

Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter J" wrote in message ...
Hi Ron

Work great. Thanks alot.

Perhaps you can help me with the next arising problem which is I need all
the info which is at the bottom of the invoice ( Starting at row 40) to
remain there and not move up and down the page when the number of printable
items changes.

--
Peter J




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
List and subtotal selected items, then print separate item list TitanG Excel Worksheet Functions 0 September 8th 08 09:07 PM
dynamic print area based on cell value [email protected] Excel Worksheet Functions 2 June 14th 06 04:23 AM
set print area based on selection crombes Excel Programming 0 November 2nd 05 07:15 PM
set print area based on selection crombes[_2_] Excel Programming 0 November 2nd 05 07:15 PM
Make button to print Multiple occurences of item based on input CarpeDiemFL Excel Programming 4 December 2nd 03 01:35 PM


All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"