A
Alan
I have what I thought would be a very simple loop: I am trying to copy
the comments from the cells in row (rRow-1) to row (rRow) for columns
3 to 26. Some of the cells in rRow-1 have comments others do not so I
thought that I would use simple error trapping to help me to navigate.
Columns 3 to 13 contain comments and all is fine, column 14 has no
comment and again the code works, column 15 has no comment and the
script blows freezes on the line
Txt = .Cells(rRow - 1, i).Comment.Text
To make matters worse, subsequent cells that contain comments then
also blow up on
.Cells(rRow, i).AddComment
Could you offer any pointers about where I am going wrong?
For i = 3 To 26
On Error GoTo 1
' Does a comment exist to copy? (no comment, skip to Next)
Txt = .Cells(rRow - 1, i).Comment.Text
' Does a comment exit to paste to?
On Error Resume Next
.Cells(rRow, i).AddComment
On Error GoTo 0
' Insert comment text
.Cells(rRow, i).Comment.Text Text:=Txt
1: Next i
the comments from the cells in row (rRow-1) to row (rRow) for columns
3 to 26. Some of the cells in rRow-1 have comments others do not so I
thought that I would use simple error trapping to help me to navigate.
Columns 3 to 13 contain comments and all is fine, column 14 has no
comment and again the code works, column 15 has no comment and the
script blows freezes on the line
Txt = .Cells(rRow - 1, i).Comment.Text
To make matters worse, subsequent cells that contain comments then
also blow up on
.Cells(rRow, i).AddComment
Could you offer any pointers about where I am going wrong?
For i = 3 To 26
On Error GoTo 1
' Does a comment exist to copy? (no comment, skip to Next)
Txt = .Cells(rRow - 1, i).Comment.Text
' Does a comment exit to paste to?
On Error Resume Next
.Cells(rRow, i).AddComment
On Error GoTo 0
' Insert comment text
.Cells(rRow, i).Comment.Text Text:=Txt
1: Next i