View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Fill colum to the next non blank row

If you want a non-VBA method, insert a column next to your original data and
enter the following formula:

=IF(ROW(A1)1,IF(A1="",OFFSET(A1,-1,0),A1),A1)

Change "A1" to the first data cell. Then, copy this formula down as far as
your data goes. If desired, you can copy the value of this new column and do
a Paste Special Values from the Edit menu to overwrite the existing data.
Then you can delete the column you just added.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Chip Pearson" wrote in message
...
Here's a simple little macro that will do the job. Select the range whose
blank cells you want to fill. In your example data, this would be the
range beginning with the first "New York" record and then downward through
the last null row of the "California" group. Then run the code.

Sub FillIn()
Dim Rng As Range
Dim V As Variant

For Each Rng In Selection.Cells
If Rng.Text < vbNullString Then
V = Rng.Text
Else
Rng.Value = V
End If
Next Rng
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"coastal" wrote in message
...
Ok,
Not sue how to explain this so I will just describe it:

Here is an shortened sample of the file that I am working with:
1,New York, Joe Smith, AddressA
2,(null), Mary Joe, AddressB
3,(null), Jim Bob, AddressC
4,California, Billy Joel, AddressD
5,(null), Jane Doe, AddressE
6,(null), Mary Jane, AddressF

What I need to do is fill the (null) cells with the title above it (so
rows
2 & 3 should have New York in the (null) cell. Problem is there are
hundreds
of rows. Is there a way to fill a column so that the text "New York" is
filled up only to the row that contains more text (in this case
California,
row 4)?



--
--coastal