Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm trying to copy the formulas from the first row starting from B2 to some finite column number and applying these formulas (which may be different) to a dynamic number of rows. In other words, the "BK6" is not a fixed value. How can I achieve this? Thanks! Range("B2").Select Range(Selection, Selection.End(xlToRight)).Select Selection.AutoFill Destination:=Range("B2:BK6"), _Type:=xlFillDefault |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you want this final row to be user specified?
Dim iLastCol As Long Dim iLastRow As Long iLastCol = Cells(2, Columns.Count).End(xlToLeft).Column iLastRow = InputBox("specify last row #") Range("B2", Cells(2, iLastCol)).AutoFill _ Destination:=Range("B2", Cells(iLastRow, iLastCol)), Type:=xlFillDefault -- HTH Bob Phillips wrote in message ps.com... Hi, I'm trying to copy the formulas from the first row starting from B2 to some finite column number and applying these formulas (which may be different) to a dynamic number of rows. In other words, the "BK6" is not a fixed value. How can I achieve this? Thanks! Range("B2").Select Range(Selection, Selection.End(xlToRight)).Select Selection.AutoFill Destination:=Range("B2:BK6"), _Type:=xlFillDefault |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nope. It should be determined through a count of the first column's
number of rows. Will try out your suggestion. Thanks! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay, then use this
Dim iLastCol As Long Dim iLastRow As Long iLastCol = Cells(2, Columns.Count).End(xlToLeft).Column iLastRow = Cells(Rows.Count,"B").End(xlUp).Row Range("B2", Cells(2, iLastCol)).AutoFill _ Destination:=Range("B2", Cells(iLastRow, iLastCol)), _ Type:=xlFillDefault -- HTH Bob Phillips wrote in message oups.com... Nope. It should be determined through a count of the first column's number of rows. Will try out your suggestion. Thanks! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob, works like a charm.
Yeh Wei |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autofill counting up Columns and Rows! | Excel Worksheet Functions | |||
Autofill Macro for 2 rows and 100 columns | Excel Programming | |||
Autofill Macro for 2 rows and 100 columns | Excel Programming | |||
autofill information from rows to columns without using transpose | Excel Discussion (Misc queries) | |||
Autofill formula to last row with data when rows will be dynamic | Excel Programming |