PC Review


Reply
Thread Tools Rate Thread

Autofill to the last empty cell in a range

 
 
Jim
Guest
Posts: n/a
 
      13th Feb 2009
I have a list that looks like this:

10010 11221 102.00
102.00
102.00
10011 11247 103.50
103.50
103.50


The list goes on for thousands of rows. The columns are A, B and C.
I am trying unsucessfully to create a macro to autofill the first two
columns until the numbers change. In other words, 10010 would stop at
the last empty cell above 10011. It would repeat this all down the
page.

I am currently trying to count up from the bottom of the page...but I
don't know the code to loop the formula.

Thanks
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      13th Feb 2009
Sub fillcolumns()

RowCount = 1
StartRow = RowCount
Do While Range("C" & RowCount) <> ""
If Range("A" & (RowCount + 1)) <> "" Or _
Range("C" & (RowCount + 1)) = "" Then

Range("A" & StartRow & ":B" & StartRow).Copy _
Destination:=Range("A" & StartRow & ":B" & RowCount)

StartRow = RowCount + 1
End If

RowCount = RowCount + 1
Loop
End Sub


"Jim" wrote:

> I have a list that looks like this:
>
> 10010 11221 102.00
> 102.00
> 102.00
> 10011 11247 103.50
> 103.50
> 103.50
>
>
> The list goes on for thousands of rows. The columns are A, B and C.
> I am trying unsucessfully to create a macro to autofill the first two
> columns until the numbers change. In other words, 10010 would stop at
> the last empty cell above 10011. It would repeat this all down the
> page.
>
> I am currently trying to count up from the bottom of the page...but I
> don't know the code to loop the formula.
>
> Thanks
>

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      13th Feb 2009

See John Walkenbach's clever, non vba, method...
http://spreadsheetpage.com/index.php...ies_in_a_list/
--
Jim Cone
Portland, Oregon USA



"Jim" <(E-Mail Removed)>
wrote in message
I have a list that looks like this:

10010 11221 102.00
102.00
102.00
10011 11247 103.50
103.50
103.50

The list goes on for thousands of rows. The columns are A, B and C.
I am trying unsucessfully to create a macro to autofill the first two
columns until the numbers change. In other words, 10010 would stop at
the last empty cell above 10011. It would repeat this all down the
page.
I am currently trying to count up from the bottom of the page...but I
don't know the code to loop the formula.
Thanks
 
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
Insert selected cell value into next cell in range that is empty Guy Microsoft Excel Worksheet Functions 6 3rd Jan 2009 10:08 PM
'Autofill' macro for range of checkbox cell links njankovic@gmail.com Microsoft Excel Misc 1 5th Dec 2006 02:44 PM
Finding next empty empty cell in a range of columns =?Utf-8?B?VW5jbGVCdW4=?= Microsoft Excel Programming 1 13th Jan 2006 11:22 PM
Dynamic Range Based on Cell Result not Empty Cell ExcelMonkey Microsoft Excel Discussion 3 11th Jun 2004 08:22 PM
Autofill a range of cells based a a txt value in a separate cell c20driver Microsoft Excel Misc 2 5th May 2004 03:26 PM


Features
 

Advertising
 

Newsgroups
 


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