![](/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.