這絕對是一個新手問題,但真的讓我非常沮喪。我無法弄清楚爲什麼我會在將值賦給一個變量後丟失了值。奇怪的是,顯示cell_location沒有問題,但cell_locaton1在消息框中變爲空。奇怪的丟失字符串值
Sub COPYCELL()
Dim bottomCell As Range
Dim offsetCell As Range
Dim cell_location As String
Dim cell_location1 As String
Dim SC As String
With ActiveSheet
Set bottomCell = .Cells.Find(what:="XXX")
Set offsetCell = .Cells.Find(what:="YYY")
cell_location = "A" & bottomCell.Row
cell_locaton1 = "A" & offsetCell.Row
SC = cell_location & ":" & cell_location1
MsgBox SC
End With
End Sub
這個問題的最佳答案是兩個字:Option Explicit。試試:) –
cell_locaton1 =「A」中有一個錯字&offsetCell.Row –