Thread: Fill down a row
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GTVT06 GTVT06 is offline
external usenet poster
 
Posts: 141
Default Fill down a row

On Jan 16, 5:13*pm, Joanne wrote:
WinXP Pro MSOffice 2003 Pro

I have a spreadsheet with hundreds of rows and 15 columns

Col A holds Company name
Each Company can have any number of line items on the spreadsheet
Col A has the Company name in the company's first line item only, then
the rest of Col A is empty until the company name changes.

I need to get Company name in Col A on each and every line item for the
company. I know I need to read the Company Name, then recognize cells in
col A that are empty (up to a new company name), copy the company name
into those cells, proceed to the next cell and read the next company
name, recognize the empty cells for that company, copy the name there
and etc until I reach the end of the spreadsheet.

Could someone help me with this, or point me to an example somewhere so
I can help myself?

I sure appreciate your time and effort.
Thanks
Joanne



hello, try this:

Sub filldwn()
Dim cell As Range
'adjust the range below to fit your needs
For Each cell In Range("A1:A50")
If cell.Value = "" Then
cell.Select
ActiveCell.End(xlUp).Copy cell
End If
Next cell
End Sub