+ Reply to Thread
Results 1 to 4 of 4

Macro to return data into a comment

  1. #1
    Registered User
    Join Date
    05-03-2008
    Posts
    1

    Macro to return data into a comment

    Hi all,

    I'm a fairly novice Excel user and I'm trying to set-up a simple project scheduling workbook for my company.

    I was hoping that one of you may know how I can do the following...

    I want to set-up a macro that I can run that will:

    Search column A on two separate worksheets (sheets 1 and 2)
    If data is found on sheet 1 that matches data on sheet 2, do the following:
    Return the data contained in a specified column corresponding to the particular row in which the match was made, onto the other sheet.
    Here's the even trickier part... I want it returned in the form of a comment in a specified cell on sheet 1

    Confused?

    Here's an example --

    Sheet 1 has a list of 3 people:
    Column A (Name) - John, Frank, Sally
    Column B (Eye Colour) - Green, Blue, Brown

    Sheet 2 has a list of 4 people
    Column A (Name) - Mark, Paul, Megan, Sally
    Column B (irrelevant data) - blah, blah, blah, blah
    Column C (irrelevant data) - blah, blah, blah, blah


    I want to run a macro that will search column A on both sheets. When it matches "Sally", I want it to return "Eye colour - Brown" as a comment in cell C4 on sheet 2.

    I obviously intend for this to run on a larger scale than what's listed in the example. Each sheet in my workbook has about 100 data sets which are constantly changing.

    AM I CRAZY?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    04-24-2008
    Location
    Zurich
    Posts
    45
    Hi Aaron
    this should work:

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by Aaron W
    Hi all,


    I want to run a macro that will search column A on both sheets. When it matches "Sally", I want it to return "Eye colour - Brown" as a comment in cell C4 on sheet 2.

    I obviously intend for this to run on a larger scale than what's listed in the example. Each sheet in my workbook has about 100 data sets which are constantly changing.

    AM I CRAZY?
    Hi,

    Try the following. It puts the comments in column D since your note suggests columns B&C have data, albeit irrelevant. If you want the comments in column C, just alter the offset '5' in
    Range("A2").Cells(x, 5).AddComment to a '4'

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1