0
我是新的excel VBA編碼。 我有一行中最後一個非空白單元格的地址A1 現在我要移動到下一個右側單元格。移動到連續的下一個單元格
Dim ws As Worksheet
Dim cell1 As String
Dim cell2 As String
Dim rng1 As Range
Set ws = Sheets("ADS User Data")
Set rng1 = ws.Rows(1).Find("*", ws.[a1], xlFormulas, , xlByColumns, xlPrevious)
MsgBox rng1
If Not rng1 Is Nothing Then
'MsgBox "rng1 contains " & rng1.Address(0, 0)
cell1 = (rng1.Address(0, 0))
cell2 = ActiveCell.Offset(1, 0).Select()
MsgBox cell1
MsgBox cell2
Else
MsgBox ws.Name & " row A1 is completely empty", vbCritical
End If
輸出單元格地址:API1
詢價是:向右移動到輸出單元格地址(API1),即輸出APJ1
任何人可以幫助我PLZ。
'CELL2 = rng1.Offset(0, 1).Address(0,0)' –
這工作正常。感謝斯科特。 – Dhiman