+ Reply to Thread
Results 1 to 8 of 8

Rename macro button

  1. #1
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Talking Rename macro button

    hi, I'm trying to rename a macro button (see my attached sheet)...
    The function is to click "button1" to add 1 to the cell at right (F4).

    But as you can see from my sheet the second button2 also adds to the first cell.
    this should not happen! it should add to its own cell (F7).

    Macro is new to me, any help would be grateful on this...
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Rename macro button

    You have both buttons* assigned to the same macro so they are going to do exactly the same thing. One simple way to resolve this is to create a second macro for the second button. See attached.

    _____________________________
    *They are actually shapes with macros assigned, not true Button controls
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: Rename macro button

    thanks 6string,
    That works, but as I'm going to use 50+ buttons... can all the codes be related to a single macro code.
    that's why I what'd to refer to different buttons by name...

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Rename macro button

    One option is to determine the position of the button relative to a cell, then update the value of a cell relative to that cell. However, your shapes have to be placed very precisely for this to work. For example, your first button was located in C4. It may not look like it but the left edge bleeds over into C4 very slightly. I have adjusted it so it's in D4. The other one is in D7. Then the macro updates the cell two cells to the right.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: Rename macro button

    that worked thanks

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Rename macro button

    If your question has been answered please mark your thread as "Solved" so that members will know that your problem is solved.

    Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

  7. #7
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: Rename macro button

    thanks for this
    Attached Files Attached Files
    Last edited by Stews; 10-20-2013 at 12:10 PM.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Rename macro button

    I see you have edited your post; the previous version said your button didn't work. Note from my earlier post:
    Quote Originally Posted by 6StringJazzer View Post
    ...your shapes have to be placed very precisely for this to work.
    Your first button has its top left corner in column A but the second is in column B. So the second is trying to update a number two to the right but that's not a number. That's why you're getting the error. You just need to position your shapes carefully.

+ 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. macro to make command button labels rename to match a cell value
    By Jake_fielder in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-08-2013, 09:58 AM
  2. rename option button in form according to cell value
    By rename in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2013, 09:21 PM
  3. Rename Command Button
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2012, 04:16 AM
  4. Macro for button to create new worksheet and rename with todays date
    By BBXguy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2009, 03:47 PM
  5. Rename Command Button
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2008, 09:50 AM

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