Hi all
I have a table of data where I need to fill columns A, B and D with a formula or text contained in the final cell of each of those column. Column C is filled with data and has more rows.
I want to count the number of rows in column C, go to final cell in column A and fill down to match the number of rows containing data in column C. Next proceed to column B and repeat the same fill down and lastly repeat the action in column D.
I have tried the following but it doesn't do anything. Are you able to help please?
Edited to add: the data is in a Table called 'Priorities' therefore I could substitute references to the columns with the column Names.
I have a table of data where I need to fill columns A, B and D with a formula or text contained in the final cell of each of those column. Column C is filled with data and has more rows.
I want to count the number of rows in column C, go to final cell in column A and fill down to match the number of rows containing data in column C. Next proceed to column B and repeat the same fill down and lastly repeat the action in column D.
I have tried the following but it doesn't do anything. Are you able to help please?
Edited to add: the data is in a Table called 'Priorities' therefore I could substitute references to the columns with the column Names.
VBA Code:
Sub Autofill_Columns()
Dim lrow As Long
lrow = Range("C" & Rows.Count).End(xlUp).Row
Range("A" & lrow, Range("A" & Rows.Count).End(xlUp)).FillDown
Range("B" & lrow, Range("B" & Rows.Count).End(xlUp)).FillDown
Range("D" & lrow, Range("D" & Rows.Count).End(xlUp)).FillDown
End Sub
fruits.xlsm | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Priority | Source | Item | Color | ||
2 | 2 | Grocery Store | Apple | Green | ||
3 | Pear | |||||
4 | Kiwi | |||||
Sheet2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2 | A2 | =1+1 |