View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Copy or Fill Down Macro?

One way. This will cycle through column A and fill blank cells with
the value from the previous cell until the last used row in the
spreadsheet is reached. Test on copy of data before running on
production data to make certain this is what you are after.
Sub this()
lRow = Cells.Find(what:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For i = 1 To lRow
If Trim(Cells(i, 1).Offset(1)) = "" Then _
Cells(i, 1).Offset(1) = Cells(i, 1)
Next i
End Sub
Chuck wrote:
I have a spreadsheet that was sent to me that lists Store Numbers, Item
Descriptions and QTY sold. The Spread sheet is 25000 lines long. The problem
i am coming across is the store number cells are merged together. When
unmerge the cells only the first Descrption next to the store number has a
store number associated with it. And everyone below it had a blank cell. So
the data is useless to me in Access because I need to have a store number for
each description. Is there a macro i can create or run that will paste the
first number in the column all the way down and then once is hits a new or
different store number it copies that number and pastes it in all the empty
cells below that, finds the next change in number, copies it and pastes....so
on and so forth. So the end result is there is a corresponding store number
with each product description.