Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Monroeville, Pennsylvania, USA
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor selection (2002)

    What I want to do is to choose - by a cursor click in a cell, in a given range, say, B1 thru B10,
    ie: if I click in B1, that value will be put into A1. If I click in B6, that value will be put in A1 etc. etc.
    The rest of the spreadsheet should work normally. Can this be done, and how?

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Cursor selection (2002)

    Hi Ramrod,

    You need an event-driven macro for this.

    Event-driven macros are placed in the worksheet in which the events take place. To assign the macro to a worksheet, use VBA
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Monroeville, Pennsylvania, USA
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    Thanks for the help. Problem..... I'm not a VBA operative. Can you direct a low level novice a bit more in installing the code?

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Cursor selection (2002)

    Hi Ramrod,
    I didn't assume any knowledge, which is why I outlined the process. Assuming you've tried it, which part are you having trouble with?
    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Monroeville, Pennsylvania, USA
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    Is this code installed in the same way that a macro is, or am I missing something? I've opened the Visual Basic editor and the excel sheet I'm using. I have a window opened in VB that has two drop down menus, .the left one says "general" ...the right "Worksheet_selectionchange". I've pasted the code in this area. When I try to run the macro, or open the worksheet I get a message that says the macro cannot be found.

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Cursor selection (2002)

    Hi Ramrod,

    The macro is worksheet-specific, so it must be attached to the worksheet it affects. Pasting it in another worksheet or some other code module won't work. Also, because the macro is event-driven, you don't need to select it - it runs by itself.

    So, let's make sure you're setting it up properly:

    In the VBE Project Window, double-click on the name of the worksheet you want the macro to work on.

    At the top-left side of the Code Window, you should now see a drop-down box with
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Monroeville, Pennsylvania, USA
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    Please have patience. Either I'm thick headed or I am missing something.
    Let's see if I am going thru the correct steps.
    In order to open the VBE Project Window, I drop down the tools menu and click on, "Macro" - "Visual basic editor". ( I suspect that this is the wrong place to go)
    The screen I get does not have the window you describe. Should I be using the Microsoft Script editor instead? Or .......? The left drop down menu only has "General" as a choice. Take a look at the attached file
    PS: I need to send myself messages in order to remember who I am.
    Attached Images Attached Images

  8. #8
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Cursor selection (2002)

    View - Project explorer (in Xl97 it is also ctrl-R) to to get the project explorer visible.

    Then follow macropod's instructions.

    Steve

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    To get the window he is talking about select "Project Explorer" on the "View" menu. You may also want to select "Properties Window" from the "View" menu to get the standard VBE configuration. It should look like this:
    Attached Images Attached Images
    Legare Coleman

  10. #10
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    Try the following :

    1. Select the sheet you are working with in Excel.

    2. Right click on the sheet tab.

    3. Select View Code.

    4. You should see a window with the sheet's code pane. (Looks like a normal module)

    5. Paste macropod's code into that window.

    6. Return to the sheet and hopefully the functionality you require will be available.

    Andrew C

  11. #11
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Monroeville, Pennsylvania, USA
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor selection (2002)

    Many Thanks to all who were involved. I finally understand how. The right click on the sheet tab did it for me. The code works just fine.
    Thanks again.

Posting Permissions

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