Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default fill in data that is not empty

On Tuesday, October 16, 2012 8:29:59 AM UTC-5, Tariq Khalaf wrote:
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


Different ways. Reply to dguillett1 @gmail.com with your file.
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
fill down empty cells at every change in value Rose Excel Worksheet Functions 4 March 24th 09 03:03 PM
How can I program excel to shift data up to fill empty cells? Howlingstraycat Excel Discussion (Misc queries) 1 December 22nd 07 11:58 PM
Fill empty cells [email protected] Excel Programming 2 May 23rd 06 04:44 PM
Fill empty cells Thiem[_2_] Excel Programming 1 January 9th 06 11:03 AM
fill cell value to the next empty row adey v. Excel Discussion (Misc queries) 2 November 15th 05 01:47 AM


All times are GMT +1. The time now is 01:15 PM.

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"