r/vba•
wevia

How do I add a comment to a cell with text from another cell?

Hi

I'm trying to add a comment to a cell with text from another cell, but all I get is "type mismatch".

This is what I'm trying:

ActiveWorkbook.Sheets(1).Cells(y1, x1).AddComment

ActiveWorkbook.Sheets(1).Cells(y1, x1).Comment.Text (ActiveWorkbook.Sheets(2).Cells(y2, x2).Value)

I'm also tried to use str() around the value cell, but still get the same error.

Anyone know how I can get this to work?

EDIT: I found the solution. I need to use .text instead of .value

ActiveWorkbook.Sheets(1).Cells(y1, x1).Comment.Text (ActiveWorkbook.Sheets(2).Cells(y2, x2).text)

Posted Jan 25, 2013, 8:56 AM UTC · edited

32
Loading comments…