Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy cell to empty cells below.

Hello folks.
My spreadsheet has 22000 rows. The data import was from an html
report from another app.
Column A is as shown, column B has data in cells 1 through 9. So
column B is no problem. When I apply a autofilter on the sheet column
A most of the time shows blanks. I need to fill in the blanks with
the preceeding nonblank. If it is nonblank it should skip to the next
line and try again. I'm familiar with if then else and for next
loops but not the MS Excel way of doing things. Syntax errors
galore. My other problem is that Im not sure where to put this
formula / script.

I want this:

A
1 blah
2
3
4 blah blah
5
6
7 hohum
8
9


To Turn into this:

A
1 blah
2 blah
3 blah
4 blah blah
5 blah blah
6 blah blah
7 hohum
8 hohum
9 hohum

Any help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copy cell to empty cells below.

See
http://www.contextures.com/xlDataEntry02.html

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message ...
Hello folks.
My spreadsheet has 22000 rows. The data import was from an html
report from another app.
Column A is as shown, column B has data in cells 1 through 9. So
column B is no problem. When I apply a autofilter on the sheet column
A most of the time shows blanks. I need to fill in the blanks with
the preceeding nonblank. If it is nonblank it should skip to the next
line and try again. I'm familiar with if then else and for next
loops but not the MS Excel way of doing things. Syntax errors
galore. My other problem is that Im not sure where to put this
formula / script.

I want this:

A
1 blah
2
3
4 blah blah
5
6
7 hohum
8
9


To Turn into this:

A
1 blah
2 blah
3 blah
4 blah blah
5 blah blah
6 blah blah
7 hohum
8 hohum
9 hohum

Any help is greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Copy cell to empty cells below.

Try something like this.....the easiest place to put this code is copy the
code, then right-click the worksheet tab choose "view code" and paste. To
run choose from the Excel toolbar tools-macro-macros then select "Infill"
and click Run. If using xl2007 then choose the Developer ribbon - Macros -
choose "Infill" click Run. Or from the sheet code place cursor somewhere in
the sub Infill code and click Run.

The following code fills in the gaps with the preceding non-empty value, it
only works down the rows, so it only fills after the first non empty row in
column A. Column B is used to determine the row extent.

Sub Infill()
Dim xRow As Long, xCell

With Sheets("Sheet1") ' < change this to suit
xRow = 1
Do While xRow <= .Cells(Rows.Count, "B").End(xlUp).Row
If Len(Trim(.Cells(xRow, 1))) 0 Then
xCell = .Cells(xRow, 1)
Else
.Cells(xRow, 1) = xCell
End If
xRow = xRow + 1
Loop
End With
End Sub

--

Regards,
Nigel




wrote in message
...
Hello folks.
My spreadsheet has 22000 rows. The data import was from an html
report from another app.
Column A is as shown, column B has data in cells 1 through 9. So
column B is no problem. When I apply a autofilter on the sheet column
A most of the time shows blanks. I need to fill in the blanks with
the preceeding nonblank. If it is nonblank it should skip to the next
line and try again. I'm familiar with if then else and for next
loops but not the MS Excel way of doing things. Syntax errors
galore. My other problem is that Im not sure where to put this
formula / script.

I want this:

A
1 blah
2
3
4 blah blah
5
6
7 hohum
8
9


To Turn into this:

A
1 blah
2 blah
3 blah
4 blah blah
5 blah blah
6 blah blah
7 hohum
8 hohum
9 hohum

Any help is greatly appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy cell to empty cells below.

Tested and they work!!!
Thank you Ron and Nigel.
This is Awsome!!

One time project, and I really did not look forward to the thought of
doing it manually.
Thanks again!

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
Copy info into empty cells below info, until finds cell with new d Fat Jack Utah Excel Discussion (Misc queries) 3 November 16th 08 08:34 PM
copy only non-empty cells Dean[_8_] Excel Programming 12 February 7th 07 01:05 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? Steven Rosenberg Excel Programming 0 August 5th 03 06:10 AM
SOS VBA Code Emergency: need to copy tell to empty cell direct below where values in adjacent cells in different column are equal to each other. Steven Rosenberg Excel Programming 4 August 5th 03 05:05 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Excel Programming 1 August 5th 03 04:34 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"