Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro that will autofill a column with data, up to the last row of data in previous c


Hi everyone,

I beleive this is a relatively simple question, but it is frustratin
me a lot. I would like to use the simplest possible macro to fill
number of specified columns with data. I always know which row the dat
should begin in. I would like to feed off another column in the sam
sheet for my range, but data in this column fluctuates. Should I use a
IfEmpty function...? If so how would you write it?

Cheers!

Ma

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro that will autofill a column with data, up to the last row of data in previous c

Try this

Will FillDown b1:d1 till the last row with data in column A

Sub test()
Dim a As Long
a = Range("A" & Rows.Count).End(xlUp).Row
Range("B1:D" & a).FillDown
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Max Velocity" wrote in message ...

Hi everyone,

I beleive this is a relatively simple question, but it is frustrating
me a lot. I would like to use the simplest possible macro to fill a
number of specified columns with data. I always know which row the data
should begin in. I would like to feed off another column in the same
sheet for my range, but data in this column fluctuates. Should I use an
IfEmpty function...? If so how would you write it?

Cheers!

Max


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro that will autofill a column with data, up to the last row of data in previous c


Okay so lets say that I have formulas in Cells: B2,C2,D2,E2
And at the end of my macro I want to have the contents of the abov
four cells filled down all the way to where the data ends in column A


How does this work? Do I have to repeat all the formulas? Forgive m
i'm a VBA beginner.

Cheers,

Lysande

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro that will autofill a column with data, up to the last row of data in previous c

Use this example

Lrow = Range("A" & Rows.Count).End(xlUp).Row
This line will give you the row number of the last cell with data in Column A

Range("B2:E" & a).FillDown
This line will FillDown the cells B2:E2 to the row Lrow

Sub test2()
Dim Lrow As Long
Lrow = Range("A" & Rows.Count).End(xlUp).Row
Range("B2:E" & Lrow).FillDown
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Max Velocity" wrote in message ...

Okay so lets say that I have formulas in Cells: B2,C2,D2,E2
And at the end of my macro I want to have the contents of the above
four cells filled down all the way to where the data ends in column A.


How does this work? Do I have to repeat all the formulas? Forgive me
i'm a VBA beginner.

Cheers,

Lysander


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro that will autofill a column with data, up to the last row of data in previous c


Thanks Ron its Perfect. Although it appears that It cannot be used mor
than once in a sub (

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

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
Need Macro to autofill formula to last row with data Joe M. Excel Discussion (Misc queries) 4 January 22nd 10 07:54 PM
Based on data in previous column - sum of values in next column Beena K Excel Worksheet Functions 1 April 7th 09 07:23 PM
How do I autofill data in a column? jimmiller17 Excel Discussion (Misc queries) 2 February 12th 08 11:05 AM
Shortcut to select column with data in previous column TJAC Excel Discussion (Misc queries) 1 July 10th 07 06:12 PM
Looking up previous data in column within an IF statement CheekyFlash Excel Worksheet Functions 0 October 9th 06 05:19 PM


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

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"