![](/img/trans.png)
[英]Excel VBA - How to change a cell reference to the second last and last column
[英]Excel VBA: How to change value of cell in last used column?
我是VBA的新手,正在尝试查找上一次使用的列(每月更改),并将该列中的第二行单元格更改为“ Apple”。 最后使用的列中的值从第5行开始,但是我需要更改第2行。有人可以帮忙吗? 这是我想出的代码,我知道它有缺陷:
Sub NameCell()
.Cells(5, Columns.Count).End(xlToLeft).Column.Select
.FormulaR3C1 = "Apple"
End Sub
Sub NameCell()
With ActiveSheet
.Cells(2,.Cells(5, .Columns.Count).End(xlToLeft).Column).Value = "Apple"
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.