vba 如何在 Excel 2007 中关闭 R1C1 参考样式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1018751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to switch off R1C1 reference style in Excel 2007
提问by systemovich
i'm using excel-2007. i wanted to see smth with R1C1, then i checked the "R1C1 Reference Style" (office button->Excel Options->Formulas->R1C1 Reference Style)...
我正在使用 excel-2007。我想用 R1C1 看看 smth,然后我检查了“R1C1 参考样式”(办公室按钮-> Excel 选项-> 公式-> R1C1 参考样式)...
Now i wanted to move again back to xlA1 style, i unchecked the R1C1 Reference Style, but my macros are still written in the R1C1 style... how can i switch to xlA1 reference style so that my macros again written in the xlA1 style? thanks
现在我想再次回到 xlA1 样式,我取消选中 R1C1 参考样式,但我的宏仍然以 R1C1 样式编写……我如何切换到 xlA1 参考样式,以便我的宏再次以 xlA1 样式编写?谢谢
i tried recording macros again it does not work!
我再次尝试录制宏它不起作用!
回答by systemovich
You will have to manually edit the code [scratch out]or record the macros again[/scratch out].
您必须手动编辑代码 [scratch out] 或再次录制宏 [/scratch out]。
EDIT:
编辑:
The Office Button>Excel Options>Formulas>R1C1 Reference Styleoption only applies to the reference style as it appears in a cell on a spreadsheet.
“ Office 按钮”>“Excel 选项”>“公式”>“R1C1 参考样式”选项仅适用于电子表格单元格中显示的参考样式。
With the R1C1 reference style off, I recorded a macro in which cell "A2" is initially selected. After the recorder starts, I enter the following forumla into "A2": =A1+12, press enter and stop the recorder. The recorded code is:
关闭R1C1 引用样式后,我录制了一个宏,其中最初选择了单元格“A2”。录音机启动后,我在“A2”中输入以下论坛:=A1+12,按回车并停止录音机。记录的代码是:
ActiveCell.FormulaR1C1 = "=R[-1]C+12"
Range("A3").Select
With the R1C1 reference style on, the code looks exactly the same:
启用R1C1 参考样式后,代码看起来完全相同:
ActiveCell.FormulaR1C1 = "=R[-1]C+12"
Range("A3").Select
The reason is that macro recorder always stores the formula in the FormulaR1C1 propertyof the ActiveCell object.
原因是宏记录器总是将公式存储在ActiveCell 对象的FormulaR1C1 属性中。
One would have to manually edit the code like this to be in xlA1 style:
必须手动编辑这样的代码才能使用 xlA1 样式:
ActiveCell.FormulaR1C1 = Range("A1").Value + 12
回答by NITESH
Go in to the file menu->option->formula-> then uncheck r1c1 reference style
进入文件菜单->选项->公式->然后取消选中r1c1参考样式

