将合并单元格的内容转换为注释或注释
Converting merged cell's content to Note or Comment
想法是将合并单元格的内容转换为注释或评论。我找到了这段代码
'Convert Cell Content to Comment
Sub ConvertToComment()
Dim C As Range
For Each C In Selection
C.ClearComments
If Len(C.Value) > 0 Then
C.AddComment
C.Comment.Text C.Value & ""
End If
'Optional: Delete cell content after converting
C.ClearContents
Next C
End Sub
但这对合并的单元格不起作用。应用时会弹出错误 400。请帮忙解决一下?
我可能是错的,但我相信你的问题出在 C.ClearContents
行上。
也许试试这个...
'Convert Cell Content to Comment
Sub ConvertToComment()
Dim C As Range
For Each C In Selection
C.ClearComments
If Len(C.Value) > 0 Then
C.AddComment
C.Comment.Text C.Value & ""
End If
'Optional: Delete cell content after converting
C.Value = ""
Next C
End Sub
...它的效果基本相同,应该可以完成工作。
想法是将合并单元格的内容转换为注释或评论。我找到了这段代码
'Convert Cell Content to Comment
Sub ConvertToComment()
Dim C As Range
For Each C In Selection
C.ClearComments
If Len(C.Value) > 0 Then
C.AddComment
C.Comment.Text C.Value & ""
End If
'Optional: Delete cell content after converting
C.ClearContents
Next C
End Sub
但这对合并的单元格不起作用。应用时会弹出错误 400。请帮忙解决一下?
我可能是错的,但我相信你的问题出在 C.ClearContents
行上。
也许试试这个...
'Convert Cell Content to Comment
Sub ConvertToComment()
Dim C As Range
For Each C In Selection
C.ClearComments
If Len(C.Value) > 0 Then
C.AddComment
C.Comment.Text C.Value & ""
End If
'Optional: Delete cell content after converting
C.Value = ""
Next C
End Sub
...它的效果基本相同,应该可以完成工作。