View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 98
Default visual basic macro help

shadowsong,

I can't be sure, but I think your problem might be in your "For Each..." statement/loop. I would try something like this

For Each c in CommentCell
c.Offset(0, 1).Value = c.Comment.Text
Next c

If you have "Option Explicit" in General Declarations, you will need to declare "c" as a range variable. You can change "c" to
anything that is more meaningful to you.

I hope this helps,

Conan Kelly



wrote in message oups.com...
Here's what I have so far:

Sub comment_macro()

Dim CommentCell As Range

ActiveSheet.UsedRange.SpecialCells(xlCellTypeComme nts).Select

Set CommentCell = Selection

Selection.EntireColumn.Select
Selection.EntireColumn.Insert Shift:=xlToLeft

CommentCell.Select

For Each CommentCell In ActiveSheet.Cells
* CommentCell.Offset(0, 1).Value = CommentCell.Comment.Text
Next CommentCell

End Sub

i'm getting an "object variable not set" error on the asterisked line.
did i forget to define something, or should i have set CommentCell as
an Object instead of a Range?