due to some issues on the forum my post from yesterday has been deleted. some short info of what I have posted yesterday:
I have two calendars (sheet11 and sheet19) which have the exact formats.
Each cell represents one day of a year. In sheet11 there are different values than in sheet19 in the corresponsing cell.
So I would like to have a code, which takes the value of the cell in sheet19 and place it as an comment in the same cell in sheet11.
If sheet11.B2 not empty then
take value of sheet19.B2 and insert value as comment in sheet11.B2
basically he should do this for each cell...
I have tried the code which has been posted yesterday here (thanks again for this one!):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Me.Range("F8:NF75")) Is Nothing Then
Dim ans As String
Dim rr As String
rr = Target.Address
ans = Target.Value
If Sheets("Sheet11").Range(rr).Value <> "" Then
Sheets("Sheet11").Range(rr).AddComment.Text Text:=Target.Value
Else
Sheets("Sheet11").Range(rr).Value = Target.Value
'Sheets(1).Range(rr).Value = Target.Value
End If
End If
End Sub
this is what happens:
after entering a value in sheet19 I get the message:
run time error '1004'
Application defined or object defined error
I see that a comment is placed in sheet11 but without the value I was looking for, it's just empty.
when clicking on debug, it highlights following part of the code:
Sheets("Sheet11").Range(rr).AddComment.Text Text:=Target.Value
Any ideas on that one?
Thanks again!
I have two calendars (sheet11 and sheet19) which have the exact formats.
Each cell represents one day of a year. In sheet11 there are different values than in sheet19 in the corresponsing cell.
So I would like to have a code, which takes the value of the cell in sheet19 and place it as an comment in the same cell in sheet11.
If sheet11.B2 not empty then
take value of sheet19.B2 and insert value as comment in sheet11.B2
basically he should do this for each cell...
I have tried the code which has been posted yesterday here (thanks again for this one!):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Me.Range("F8:NF75")) Is Nothing Then
Dim ans As String
Dim rr As String
rr = Target.Address
ans = Target.Value
If Sheets("Sheet11").Range(rr).Value <> "" Then
Sheets("Sheet11").Range(rr).AddComment.Text Text:=Target.Value
Else
Sheets("Sheet11").Range(rr).Value = Target.Value
'Sheets(1).Range(rr).Value = Target.Value
End If
End If
End Sub
this is what happens:
after entering a value in sheet19 I get the message:
run time error '1004'
Application defined or object defined error
I see that a comment is placed in sheet11 but without the value I was looking for, it's just empty.
when clicking on debug, it highlights following part of the code:
Sheets("Sheet11").Range(rr).AddComment.Text Text:=Target.Value
Any ideas on that one?
Thanks again!