Sub TestConc()
Dim s As String
s = ConcatenateRange Range("A1:A4")
MsgBox s
End Sub
Function TraceRangeString(r As Range) As String
For Each cell In r
TraceRangeString = TraceRangeString & cell.Address & ": " & cell & " " & Chr(13)
Next cell
End Function
为什么我会在s = ConcatenateRange Range("A1:A4")
上收到语法错误?
答案 0 :(得分:1)
这应该有效
Sub TestConc()
Dim s As String
s = TraceRangeString(Range("A1:A4"))
MsgBox s
End Sub
Function TraceRangeString(r As Range) As String
For Each cell In r
TraceRangeString = TraceRangeString & cell.Address & ": " & cell & " " & Chr(13)
Next cell
End Function