PC Review


Reply
Thread Tools Rate Thread

Copy cell to empty cells below.

 
 
davelchgo@gmail.com
Guest
Posts: n/a
 
      5th Jan 2008
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.
 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      5th Jan 2008
See
http://www.contextures.com/xlDataEntry02.html

--

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


<(E-Mail Removed)> wrote in message news:cb0c5744-5f32-4213-8c22-(E-Mail Removed)...
> 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.

 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      5th Jan 2008
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
(E-Mail Removed)



<(E-Mail Removed)> wrote in message
news:cb0c5744-5f32-4213-8c22-(E-Mail Removed)...
> 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.


 
Reply With Quote
 
davelchgo@gmail.com
Guest
Posts: n/a
 
      6th Jan 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Data to Cells, but Stop at Next Non-Empty Cell Fester Microsoft Excel Discussion 4 17th Feb 2009 04:57 PM
Copy Data to Cells, but Stop at Next Non-Empty Cell Fester Microsoft Excel Programming 4 17th Feb 2009 04:57 PM
Copy a range of cells 15 rows down and repeat to empty cell Mike V Microsoft Excel Programming 2 6th Jun 2008 01:48 PM
Re: VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? Steven Rosenberg Microsoft Excel Programming 0 5th Aug 2003 06:10 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Microsoft Excel Programming 1 5th Aug 2003 04:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 AM.