pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi!
i have recorded this macro to convert bytes to MB and GB.
My table changes in rows not in col.
Sometimes when there is more row it does not calculate the formula, suppose there is two more row,
My formula range is from D2:D12, so it does not calculate.
I want the macro to autofill the formula if there is a value in Col a, which means if A15 has a value
then my formula should reach there.
THanks everyone.
My current code below:
[code*]
Sub Macro1()
'
' Macro1 Macro
'
'
Range("D1").Select
ActiveCell.FormulaR1C1 = "Size MB"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Size Gb"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]/(1024*1024)"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D12"), Type:=xlFillDefault
Range("D2:D12").Select
Range("E2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/1024"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E12"), Type:=xlFillDefault
Range("E2:E12").Select
Range("A1").Select
End Sub
[code*]
i have recorded this macro to convert bytes to MB and GB.
My table changes in rows not in col.
Sometimes when there is more row it does not calculate the formula, suppose there is two more row,
My formula range is from D2:D12, so it does not calculate.
I want the macro to autofill the formula if there is a value in Col a, which means if A15 has a value
then my formula should reach there.
THanks everyone.
My current code below:
[code*]
Sub Macro1()
'
' Macro1 Macro
'
'
Range("D1").Select
ActiveCell.FormulaR1C1 = "Size MB"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Size Gb"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]/(1024*1024)"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D12"), Type:=xlFillDefault
Range("D2:D12").Select
Range("E2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/1024"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E12"), Type:=xlFillDefault
Range("E2:E12").Select
Range("A1").Select
End Sub
[code*]