E
EE
Hi
I am a VBA newbie. I have a table of values In a range "A4" AL9". The
data in this table is dynamic and sometimes AL can be AX.
In B10, I have a formula that should be pasted till the last populated
column. In the above example from B10 till "AL10".
I know the place where I am stuck. (marked between stars in the code
below).
Thanks in advance.
**************
ActiveSheet.Range("A10").Select
ActiveCell.FormulaR1C1 = "Margin %"
Range("B10").Select
ActiveCell.FormulaR1C1 = "=+(R[-5]C/R[-4]C)-1"
Range("B10").Select
Selection.Style = "Percent"
Selection.NumberFormat = "0.00%"
Application.ScreenUpdating = False
CalcStatus = Application.Calculation
Application.Calculation = xlCalculationManual
***************************************
I think this refernce for the last column is where I am lost. How do I
refer to the last column.
LastColumn = ActiveSheet.Cells(4,
Columns.count).End(xlToLeft).Column
*************************************
Range("B10").Copy
Range("B11:LastColumn").PasteSpecial _
Paste:=xlPasteFormulas, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Application.Calculation = CalcStatus
Application.ScreenUpdating = True
I am a VBA newbie. I have a table of values In a range "A4" AL9". The
data in this table is dynamic and sometimes AL can be AX.
In B10, I have a formula that should be pasted till the last populated
column. In the above example from B10 till "AL10".
I know the place where I am stuck. (marked between stars in the code
below).
Thanks in advance.
**************
ActiveSheet.Range("A10").Select
ActiveCell.FormulaR1C1 = "Margin %"
Range("B10").Select
ActiveCell.FormulaR1C1 = "=+(R[-5]C/R[-4]C)-1"
Range("B10").Select
Selection.Style = "Percent"
Selection.NumberFormat = "0.00%"
Application.ScreenUpdating = False
CalcStatus = Application.Calculation
Application.Calculation = xlCalculationManual
***************************************
I think this refernce for the last column is where I am lost. How do I
refer to the last column.
LastColumn = ActiveSheet.Cells(4,
Columns.count).End(xlToLeft).Column
*************************************
Range("B10").Copy
Range("B11:LastColumn").PasteSpecial _
Paste:=xlPasteFormulas, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
Application.Calculation = CalcStatus
Application.ScreenUpdating = True