問題描述
將 A1 公式和數組轉換為 L1C1 公式,反之亦然 (convert A1 formula and Array into L1C1 formula and vice-versa)
Is there a way to convert the fashion A1 formula and array into the fashion L1C1 formula and vice-versa in Excel?
參考解法
方法 1:
Application.ConvertFormula
Method.
Application.ConvertFormula(Formula, FromReferenceStyle, ToReferenceStyle, ToAbsolute, RelativeTo)
方法 2:
Not sure if I fully understand the question but you can interchange the formula type of a cell/range using combinations of the methods below
Sub test()
With Sheet1
Set Rng = .Range("A1")
'method1
Formula = Rng.FormulaR1C1
Rng.FormulaR1C1 = Formula
'method2
Formula = Rng.FormulaR1C1
Rng.Formula = Formula
'method3
Formula = Rng.Formula
Rng.Formula = Formula
'method4
Formula = Rng.Formula
Rng.FormulaArray = Formula
End With
End Sub
方法 3:
By Chance, I was looking the book "VBA and Macros for Microsoft Office Excel 2007 - Bill Jelen" he says that: 1)In the Editor VBA; 2)type CTRL+G; 3)type "Print ActiveCell.FormulaL1C1"; 4)press Enter;
(by jbofelli、GSerg、user688334、jbofelli)