使用 Selection.Cells 在所选单元格中输入值
Enter values in selected cells using Selection.Cells
我select3个独立的单元格,比如a1,f6和g13,然后运行这个代码:
Selection.Cells(1) = 3
Selection.Cells(2) = 4
Selection.Cells(3) = 6
我希望填充 3 个 selected 单元格,而不是填充 a1、a2 和 a3。
为什么?如何填充 selection 的 3 个单元格?
如果您真的需要这样做,那么我仍然建议您放弃 Selection
,但您提供的代码只需要稍作调整即可工作:
Selection.Cells.Areas(1) = 3
Selection.Cells.Areas(2) = 4
Selection.Cells.Areas(3) = 6
我select3个独立的单元格,比如a1,f6和g13,然后运行这个代码:
Selection.Cells(1) = 3
Selection.Cells(2) = 4
Selection.Cells(3) = 6
我希望填充 3 个 selected 单元格,而不是填充 a1、a2 和 a3。
为什么?如何填充 selection 的 3 个单元格?
如果您真的需要这样做,那么我仍然建议您放弃 Selection
,但您提供的代码只需要稍作调整即可工作:
Selection.Cells.Areas(1) = 3
Selection.Cells.Areas(2) = 4
Selection.Cells.Areas(3) = 6