如果cell.offset(,45)= 1VBA:如果其他单元格的内容为其他单元格的内容添加注释= 1
我需要使用cell.offset(,23)这是我尝试:
Sub CellToCmt2()
Dim c As Range
For Each c In Selection
If target.Offset(, 45) <> 1 Then Resume Next
If target.Offset(, 45) = 1 Then
Application.EnableEvents = False
On Error Resume Next
With c.Offset(, 23)
.NoteText Text:=.Value
End With
target.ClearContents
On Error GoTo 0
End If
Next c
End Sub
但因为我有一点VBA的知识,我不断收到错误。
任何帮助,将不胜感激
编辑:这是我的作品的代码
Sub CellToCmt2()
Dim c As Range
For Each c In Selection
If c.Offset(, 45) = 1 Then
On Error Resume Next
With c
c.NoteText Text:=c.Offset(, 23).Value
End With
target.ClearContents
On Error GoTo 0
End If
Next c
End Sub
你得到了什么错误? – Fred 2014-11-04 13:45:42
运行时错误'13'使用修订后的代码尝试Steve S – 2014-11-04 14:54:33
什么是'target',它在哪里声明?你知道哪一行代码导致错误吗? – Fred 2014-11-04 15:09:24