Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Macro to autofill formula to last row with data | Excel Discussion (Misc queries) | |||
Based on data in previous column - sum of values in next column | Excel Worksheet Functions | |||
How do I autofill data in a column? | Excel Discussion (Misc queries) | |||
Shortcut to select column with data in previous column | Excel Discussion (Misc queries) | |||
Looking up previous data in column within an IF statement | Excel Worksheet Functions |