+ Reply to Thread
Results 1 to 11 of 11

Click on cell, populate another in VBA

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    MPLS
    MS-Off Ver
    Excel 2010
    Posts
    7

    Click on cell, populate another in VBA

    Good afternoon,

    I need help with a Macro in a multi-sheet workbook.

    In column A of worksheet: "All Products" I have a long list of product item numbers populating each cell. I would like to be able to click on any of these cells, and have that item number populate cell C3 in worksheet: "Sales Graphs." When clicked, I also want to be taken to that sheet. Can anyone come up with a VBA code for that? I couldn't figure one out.

    ---------- Post added at 04:05 PM ---------- Previous post was at 04:00 PM ----------

    I would like the macro to be compatible with Excel 2003 and newer. Thanks!
    Last edited by manwi004; 08-17-2012 at 09:41 AM. Reason: Need to change title

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: VBA Help

    hi manwi004, please check attachment, select non-empty cell in A column of Sheet1 and press Ctrl+G

    Code is in Module1 and ThisWorkbook(setting key combination)
    Attached Files Attached Files

  3. #3
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA Help

    Possibly...
    Please Login or Register  to view this content.
    with the code placed in the worksheet "All Products".

  4. #4
    Registered User
    Join Date
    08-02-2012
    Location
    MPLS
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Help

    Thank you watersev. This works, but not perfectly. I'm finding that the correct value is put into cell C3, but for some reason, the macros that I have pointed to cell C3 are not running with this new value. If I take that cell, and Paste Special > values, my macros run, and it works perfectly. Can you help with that?

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA Help

    Hello manwi004, and welcome to the forum.

    Thanks for changing your thread title.
    Last edited by Cutter; 08-29-2012 at 01:54 PM. Reason: Removed title change request

  6. #6
    Registered User
    Join Date
    08-02-2012
    Location
    MPLS
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Click on cell, populate another in VBA

    Thank you watersev. This works, but not perfectly. I'm finding that the correct value is put into cell C3, but for some reason, the macros that I have pointed to cell C3 are not running with this new value. If I take that cell, and Paste Special > values, my macros run, and it works perfectly. Can you help with that?

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Click on cell, populate another in VBA

    can you provide a sample file where it does not work?

  8. #8
    Registered User
    Join Date
    08-02-2012
    Location
    MPLS
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Click on cell, populate another in VBA

    On sheet1, select a number and hit CTRL-G. It will populate 'Sales Graph!'C3 with the number, and d3 with the vlookup of that number. The VLOOKUP is to an images URL. There is a macro that should fill a3 with the picture that the url points to, but that macro doesnt work. Double clicking on d3, and then selecting a different cell will run the macro. I would like this macro to run automatically.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Click on cell, populate another in VBA

    please check attachment

    I left everything as it is except commented out sheet codes.
    Attached Files Attached Files
    Last edited by watersev; 08-29-2012 at 03:41 PM.

  10. #10
    Registered User
    Join Date
    08-02-2012
    Location
    MPLS
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Click on cell, populate another in VBA

    Beautiful! Works perfectly.

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Click on cell, populate another in VBA

    @ manwi004

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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