View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Jason Lepack Jason Lepack is offline
external usenet poster
 
Posts: 120
Default How do I select nonblank data from a list?

cminor wrote:
Also, whatever method is used can't be cut and paste or anything that is not
automatic. The worksheet this is listed on is only for printing. Input is
done on another worksheet.


I'm not sure what you are saying. Are you saying that you can't use a
macro? If that is not what you are saying then try this macro instead.
I think you will like it better.

Public Sub setupPrint()
' This Sub creates a new list of item, qty, price
' for items that don't have a zero qty.
'
' Set rF to be the cell with the first item name.
' Set rT to be the top left cell of the new list.
'
' Asssumes that all rows have item names

Dim ws As Worksheet
Dim rF As Range, rT As Range

Set ws = ActiveWorkbook.ActiveSheet
' *** set this to point at the ITEM column in the old list
Set rF = ws.Range("J2")
' *** set this to point at the ITEM column in the old list

' *** change this to be wherever you want the new list
Set rT = ws.Range("O1")
' *** change this to be wherever you want the new list

rT.Value = "ITEM"
rT.Offset(0, 1).Value = "QTY"
rT.Offset(0, 2).Value = "PRICE"

Set rT = rT.Offset(1, 0)
Do While Not rF.Value = ""
If Not rF.Offset(0, -1) = 0 Then
rT.Value = rF.Value
rT.Offset(0, 1).Value = rF.Offset(0, -1).Value
rT.Offset(0, 2).Value = rF.Offset(0, 1).Value
Set rT = rT.Offset(1, 0)
End If
Set rF = rF.Offset(1, 0)
Loop
Set rT = Nothing
Set rF = Nothing
Set ws = Nothing
End Sub

cminor wrote:
Jason,

Your first illustration is exactly right, but what I want the output to look
like is this:
ITEM QTY PRICE
Item 2 2.1 .11
Item 4 4.11 .13
Item 5 3.12 .14

The output from the table data is to be elsewhere on the worksheet and won't
show the categories. There is already other data there from other
calculation and this data will follow in line with the previous.

Also, whatever method is used can't be cut and paste or anything that is not
automatic. The worksheet this is listed on is only for printing. Input is
done on another worksheet.

Thanks.

"Jason Lepack" wrote:

Cat5 Cat6 Cat7 Cat8 Total Item Name Price
0 Item1 0.1
2 2 Item2 0.11
0 Item3 0.12
2 2 Item4 0.13
3 3 Item5 0.14
0 Item6 0.15

Limited by the fact that I can only fit this many fields on the google
screen.

In this example you would want your output to look like this:
Cat5 Cat6 Cat7 Cat8 Total Item Name Price
2 2.1 Item2 0.11
2 4.11 Item4 0.13
3 3.12 Item5 0.14

Correct?

cminor wrote:
I am trying to create a list of data based on nonblank or nonzero cells in
another list. More specific: I have a group of cells, 30 Rows by 8 Columns,
which contain data (numeric) that represent quantities of 30 items from 8
categories. Each category is then totalled in the 9th column. In columns 10
and 11, I have the item name and price. Elsewhere in the worksheet, I need
to list all items that have a total quantity greater than zero along with the
item name and price. I expect this to be 6 or 8 items out of the 30.

What I am trying to avoid is listing all 30 items and having some with zero
quantities. Where the nonzero items will eventually be listed is a page to
be printed and I don't need to waste paper.