在這裏,我對你的問題的方法:
Public Sub addComment()
Dim row As Integer
Dim oldComment As String
'Set start row
row = 1
With Sheets("sheetname")
'Do until "A" cell is blank
Do While .Range("A" & row) <> ""
'If "B" cell is not blank
If .Range("B" & row) <> "" Then
'If "A" has no comment, set "" to oldComment
If .Range("A" & row).Comment Is Nothing Then
oldComment = ""
'Else comment is exist
Else
'Store that comment to oldComment
oldComment = .Range("A" & row).Comment.Text & " "
'Delete comment from cell
.Range("A" & row).Comment.Delete
End If
'Insert comment for "A" with old if exist
.Range("A" & row).addComment (oldComment & .Range("B" & row).Value)
End If
'Increase row
row = row + 1
Loop
End With
End Sub
你不必[包括在你的標題「標籤」(http://meta.stackexchange.com/questions/19190/should- questions-include-tags-in-their-titles)另請參閱[幫助中心](http://stackoverflow.com/help/tagging) – 0m3r
您是如何試圖調整代碼的?也許你可以問一個關於當你試圖解決它時遇到的問題的更有針對性的問題。 –