excel - 是否可以禁用 Excel 单元格中的“自动增量”功能?
问题描述
我的问题与 Excel 功能有关,它逐渐增加单元格的值,例如:
--------
1
-------- <-- if I insert a row here
1
--------
然后Excel“自动添加”到下面单元格中的值......就像这样
--------
1
--------
1 <-- new row inserted
--------
2 <-- original value increased from 1 to 2
--------
是否可以关闭此功能?最好通过 VBA,因为我正在使用表单按钮和宏插入行。
谢谢。
编辑1:我尝试将单元格格式化为文本无济于事。
编辑 2:我如何插入新行
Dim row As Long
Dim varResponse As Variant
Application.ScreenUpdating = False
'Message box confirming user is doing the right thing
varResponse = MsgBox("Add another row? 'Yes' or 'No'", vbYesNo, "Add Row")
If varResponse <> vbYes Then Exit Sub
'Carry on with adding a row.....
'Unprotect sheet
ActiveSheet.Unprotect Password:="****"
'Insert new row on button row
row = ActiveSheet.Buttons(Application.Caller).TopLeftCell.row
Rows(row + 1).Insert
'AutoFill from 1 row above new row, for 1 row down
Rows(row).AutoFill Destination:=Rows(row + 1 & ":" & row), Type:=xlFillDefault
'Clear cells D-J on new row
Range("D" & row & ":J" & row).ClearContents
'Protect sheet again
ActiveSheet.Protect Password:="***"
解决方案
将 xlFillDefault 替换为 xlFillCopy 也可以执行您想要的操作,具体取决于您实际想要执行的操作。– GSerg
推荐阅读
- marklogic - marklogic v7 中的某些功能在 marklogic 10 中缺失
- scala - Scala(Spark)连接数据框中的列
- php - PHP 从配置文件导入和存储数据的最佳方式
- c++ - 查找 boost 库时抛出错误
- react-native - 如何在 React Native 中正确渲染 axios 调用?
- apache - 外面的80端口只对IIS开放,怎么打开给其他服务和应用?
- python-3.x - 如何正确读取 CSV 文件?
- swift - 对具有 @State 的结构进行编码
- reactjs - AmplifySignOut 按钮仅在存在异步功能时才有效
- django - 有什么方法可以使用 url 而无需在视图中写入任何内容?