ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro that will autofill a column with data, up to the last row of data in previous c (https://www.excelbanter.com/excel-programming/283667-macro-will-autofill-column-data-up-last-row-data-previous-c.html)

Max Velocity

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


Ron de Bruin

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/




Max Velocity[_2_]

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


Ron de Bruin

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/




Max Velocity[_3_]

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



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com