Computing.Net > Forums > Office Software > Excel Macro Help: Is it even possib

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel Macro Help: Is it even possib

Reply to Message Icon

Name: Jacres
Date: August 4, 2008 at 08:21:01 Pacific
OS: Windows XP
CPU/Ram: Centrino, 1.8 GHz
Product: Dell
Comment:

Hi,
I'm trying to write a macro for a workbook where the text of a cell in one sheet receives formulated information from another sheet in the form of a comment. Say cell E5, sheet1 has the text "data"- that text cooresponds to the text "data" on sheet2, though not nexessarily in the same order. What I need to do is take a concatenated formula to the right of the sheet2 data, copy the text, and insert it into a comment of the original E5, sheet1.
However, I can't seem to find a way for the exec to reference the text in one sheet to pull data from the other. I've tried the find action, using variables, etc, but I can't seem to get it right. Any ideas?




Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: August 4, 2008 at 08:51:38 Pacific
Reply:

I don't know what you mean when you say "the text of a cell in one sheet receives formulated information from another sheet in the form of a comment."

What does "formulated information" mean?

Are you talking about actual Excel comments as in Insert...Comment?

Please provide an example of the input text and the output text and any other details that you think might help us provide some suggestions.


0

Response Number 2
Name: Jacres
Date: August 4, 2008 at 09:29:38 Pacific
Reply:

Absolutely-
Yes, I do mean the insert-comment form, sorry for the confusion. The "formulated information" was just the conatanate of other cells- but I changed it, so now it's just text. What I need to do is start with a cell's text, find that text in another sheet, and copy data from the right of it into an insert-comment field on the original cell.
I don't know if the file would help at all (I can certainly upload it)- most of it is irrelevant to the task at hand, however. Thanks for the response.


0

Response Number 3
Name: DerbyDad03
Date: August 4, 2008 at 10:15:47 Pacific
Reply:

Let's say you have this set-up:


Sheet1

A B
1 He Drives A Car
2 His Name Is Fred
3 She Has A House


Sheet2

A..B..C..D E
1
...
14
15 His Name

This code will look for the text in Sheet2!E15 (His Name) in Sheet1!A1:A3 and insert a comment in Sheet2!E15 containing the text in Sheet1!B2 (Fred) since His Name was found in Sheet1!A2.

Note: If there is already a Comment attached to E15, the code will fail. You have to delete an existing comment before you can add one.


Sub CommentBuilder()
With Worksheets(1).Range("A1:A3")
'Find the text from Sheet2!E15 in Sheet1!A1:A3
Set c = .Find(Worksheets(2).Range("E15"), LookIn:=xlValues, lookat:=xlPart)
'If found, place the text from Sheet1!B(whatever) in a comment in Sheet2!E15
If Not c Is Nothing Then
Worksheets(2).Range("E15").AddComment c.Offset(0, 1).Value
End If
End With
End Sub


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel Macro Help: Is it even possib

Excel Macro help. www.computing.net/answers/office/excel-macro-help/8054.html

Delete named columns macro help www.computing.net/answers/office/delete-named-columns-macro-help/8526.html

Excel Macro help www.computing.net/answers/office/excel-macro-help/9423.html