I copied what looked like an easy macro form a website. The macro works perfectly with the worksheet I downloaded, but when try to utilize the macro in my worksheet I receive a Run-time error.
code from website:
Code I am using with my workbook and receiving "Run-time error 91"
What am I doing wrong?
code from website:
Code:
Private Sub Worksheet_Activate()
For i = 1 To 10
Sheets("Names").Cells(i, 1).Comment.Delete
Sheets("Names").Cells(i, 1).AddComment
Sheets("Names").Cells(i, 1).Comment.Text Text:=Sheets("Ages").Cells(i, 1).Text
Sheets("Names").Cells(i, 1).Comment.Shape.TextFrame.AutoSize = True
Next
End Sub
Code I am using with my workbook and receiving "Run-time error 91"
Code:
Private Sub Worksheet_Activate()
For i = 2 To 10
Sheets("SI Mapping (accountant)").Cells(i, 23).Comment.Delete
Sheets("SI Mapping (accountant)").Cells(i, 23).AddComment
Sheets("SI Mapping (accountant)").Cells(i, 23).Comment.Text Text:=Sheets("Current.comments").Cells(i, 5).Text
Sheets("SI Mapping (accountant)").Cells(i, 23).Comment.Shape.TextFrame.AutoSize = True
Next
End Sub
What am I doing wrong?