View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tariq Khalaf Tariq Khalaf is offline
external usenet poster
 
Posts: 1
Default fill in data that is not empty

I have a list of products listed on one worksheet, but not every product will have a value. In a separate worksheet I want it to only pull over the products that have values. I have been able to output the fist column of pizza but pizza-crust will not continue

Sheet 1 called prices

list pizza pizza-crust pizza-thin
pepper 1 5 8
beef 2
bacon 3 6
pineapple 4 9
mushroom 7 10
The macro that I have does the following

list pizza
pepper 1
beef 2
bacon 3
pineapple 4
how can i get it to fill in the data for the rest of the columns so that it would put pizza crust and then the data for each and then put pizza-thin and the data for that

below is the macro

Sub Button2_Click()
Dim column As Integer
column = 1
newrow = 1
Do Until Worksheets("sheet1").Cells(column, 1).Value = ""

If Worksheets("sheet1").Cells(column, 2).Value < "" Then

Worksheets("sheet2").Cells(newrow, 1).Value = Worksheets("sheet1").Cells(column, 1).Value
Worksheets("sheet2").Cells(newrow, 2).Value = Worksheets("sheet1").Cells(column, 2).Value

newrow = newrow + 1
End If
column = column + 1
Loop
End Sub
thanks