Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am importing external data into a workbook with formulas.
I want to automate the copy-down for the formula in cell E1 to the last populated row in columns 1-4. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Option Explicit Sub testme() Dim LastRow As Long Dim iCol As Long LastRow = 0 With Worksheets("sheet1") For iCol = 1 To 4 LastRow = Application.Max(LastRow, _ .Cells(.Rows.Count, iCol).End(xlUp).Row) Next iCol .Range("e1:e" & LastRow).Formula = "=A1&b1&c1&d1" 'or maybe: .Range("e1:e" & LastRow).FormulaR1C1 = .Range("e1").FormulaR1C1 End With End Sub GEB wrote: I am importing external data into a workbook with formulas. I want to automate the copy-down for the formula in cell E1 to the last populated row in columns 1-4. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave,
Thank you. I have tried both methods successfully. GEB "Dave Peterson" wrote: One way: Option Explicit Sub testme() Dim LastRow As Long Dim iCol As Long LastRow = 0 With Worksheets("sheet1") For iCol = 1 To 4 LastRow = Application.Max(LastRow, _ .Cells(.Rows.Count, iCol).End(xlUp).Row) Next iCol .Range("e1:e" & LastRow).Formula = "=A1&b1&c1&d1" 'or maybe: .Range("e1:e" & LastRow).FormulaR1C1 = .Range("e1").FormulaR1C1 End With End Sub GEB wrote: I am importing external data into a workbook with formulas. I want to automate the copy-down for the formula in cell E1 to the last populated row in columns 1-4. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use cell to determine column in formula | Excel Worksheet Functions | |||
copy text in multiple columns into one column | Excel Discussion (Misc queries) | |||
Trying to copy text from 4 columns into 1 column with HTML? | Excel Discussion (Misc queries) | |||
Formula to determine row of hi value filtered column | Excel Discussion (Misc queries) | |||
formula to determine the first column containing any data | Excel Worksheet Functions |