+ Reply to Thread
Results 1 to 6 of 6

Selection VBA Help

  1. #1
    Registered User
    Join Date
    01-30-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Question Selection VBA Help

    Hello,
    I need some help with VBAs' since I am fairly new to it.

    This is how my spreadsheet is set up:

    Name Zip Code
    Jane Doe 90210
    John Smith 12345

    If the user clicks on the 90210 cell, it will take them to a different worksheet with a circle object being displayed around the 90210 area on a map. However, if they click the 12345 cell, it will also take them to the map worksheet but this time there will be a circle around the 12345 area. I do not want two circles being shown at the same time, but rather only one based upon which cell they click on.

    Is this possible at all?

    Thank you

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Selection VBA Help

    Yes, possible.

    Make your code hide all the circle shapes on the map worksheet before showing only the required circle shape.

    Or only have one circle shape, and set it's position based on the zip code selected.

    Several ways to do it - hard to advise specifically without seeing how your existing workbook currently does things.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    01-30-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Selection VBA Help

    What is the code to set the position based off of the zip code selection?

    I apologize in advance for I am quite new at some of this.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Selection VBA Help

    As I said - there are many approaches which MAY be taken, but to properly advise you on a solution which will fir your workbook, we'd really need to see your workbook...

    Try attaching an example file.

  5. #5
    Registered User
    Join Date
    01-30-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Selection VBA Help

    Example.xls
    I would like for the circle to appear over Santa Barbara when it is 90210 and over Los Angeles when it is 90211

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Selection VBA Help

    Okay. See my attachment, for an example of how it can work.

    Double click a zip code in column B of worksheet [Data], and the circle will move to the specified area of the map.

    I've included a button on the map, for you to map additional zip code. Just manually move the circle to the location you want, click the button, and enter your zip code. The coordinates for that zip code will then be stored in the [coords] worksheet.

    The code should be fairly straightforward to follow - when a zip code is double clicked, we look for a matching value in the [coords] list, which stores top and left positions for the circles, for each zip code. Those properties are then applied to the circle to change it's position, and the map sheet activated.

    I'd value your feedback...
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 10-07-2013, 11:06 AM
  2. Replies: 3
    Last Post: 07-31-2013, 11:53 AM
  3. [SOLVED] Range(Selection, Selection.End(xlDown)).Select goes to 65536 instead of last filled row
    By looney in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-12-2013, 10:51 AM
  4. Autolock Cells from a Drop Down List Selection and a Calendar Selection
    By John Anderson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2013, 10:54 AM
  5. Multiple selection criteria, which formula? .. and selection based on unique numbers
    By FalkirkJim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2012, 05:22 PM

Tags for this Thread

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