當前位置:成語大全網 - 書法字典 - 使用Excel VBA函數使批註隨單元格內容變化

使用Excel VBA函數使批註隨單元格內容變化

下面是我做的壹個程序,可以自動生成不同選定單元格的註釋供您參考。

私有子工作簿_SheetSelectionChange(將值Sh作為對象,將值目標作為範圍)

將註釋文本設為字符串

活動表。單元格。清除註釋

申請。狀態條=假

如果目標。計數= 1和目標。Row & gt2然後

If Len(目標。值)& gt那就0

目標。添加評論

目標。註釋。Visible = True

如果TypeName(Target。值)& lt& gt那就“弦”吧

Commenttext =“所選文本不是文本“

其他

commenttext = Target。價值

如果…就會結束

目標。Comment.Text文本:=commenttext

申請。status bar = Left(Split(Target。地址(,False)(0),1)& amp;目標。Row &。單元格“&”註釋者:“&;申請。用戶名和密碼批註內容:“&;註釋文本

目標。comment . shape . text frame . autosize = True

target . comment . shape . text frame . characters . font . name =“italics“

目標。comment . shape . text frame . characters . font . size = 14

目標。comment . shape . text frame . characters . font . colorindex = 3

目標。comment . shape . text frame . characters . font . bold = MSO true

其他

申請。status bar = Left(Split(Target。地址(,False)(0),1)& amp;目標。Row &。“細胞”

如果…就會結束

如果…就會結束

末端接頭