View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Copy Comments problem

That is a great suggestion. I started resorting to macros when I discovered
vlookup wouldnt work with comments.

"Dave Peterson" wrote:

ps. If you ever decide to redesign your workbooks, you may want to move all the
comments to just plain old cells--not comments, just values.

It would make things like this easier--just use =vlookup() to retrieve that
value.



Jay wrote:

I€„¢m working on creating a report that will insert comments from a separate
workbook. I€„¢m clear on what I want to achieve, but I€„¢m sort of clueless on
how to get there. My destination worksheet will provide a Work Order number
that is the same in the source worksheet. The comments in the source
worksheet are in the same cell as the Work Order number itself.
Any help would be greatly appreciated.

Here€„¢s what I€„¢ve got so far (but it€„¢s not working):

Sub Copy_Comment()

Dim SourcWbk As Workbook
Dim SourcRng1 As Range
Dim SourcCmt1 As Range
Dim WkOr As Range
Dim DestRng As Range
Dim cmt As Comment

Set SourcWbk = Workbooks.Open("H:\FAC\Drafting Work Queue2.xls")
On Error Resume Next
Set SourcRng1 = SourcWbk.Sheets("Work Orders").Range("A3:A200")
Set WkOr = ThisWorkbook.Sheets("Sheet1").Range("B4")
Set DestRng = ThisWorkbook.Sheets("Sheet1").Range("D4")
Set SourcCmt1 = WorksheetFunction.Offset(SrcRng1,_
(WorksheetFunction.Match(WkOr, SrcRng1, 0) - 1), 0, 1, 1)
Set cmt = SourcCmt1.Comment


DestRng.Value = cmt.Text

End Sub


--

Dave Peterson