因為不知道妳要顯示批註的具體單元格和那6個數據的具體單元格,所以我在此假設要在A1顯示批註,批註來源是A10:B12,請妳根據自己的具體情況適當更改。步驟如下:
ALT+F11,輸入如下代碼:
Private?Sub?Worksheet_Change(ByVal?Target?As?Range)Dim?strcomment?As?String
strcomment?=?Range("A10").Text?&?":"?&?Range("B10").Text?&?Chr(13)?&?Chr(10)?&?Range("A11").Text?&?":"?&?Range("B11").Text?&?Chr(13)?&?Chr(10)?&?Range("A12").Text?&?":"?&?Range("B12").Text
If?Range("A1").Comment?Is?Nothing?Then
Range("A1").AddComment
Range("A1").Comment.Visible?=?True
Range("A1").Comment.Text?Text:=strcomment
Else
Range("A1").Comment.Visible?=?True
Range("A1").Comment.Text?Text:=strcomment
End?If
End?Sub
如下圖所示: