+ Reply to Thread
Results 1 to 6 of 6

running sheet code with a button

  1. #1
    Registered User
    Join Date
    02-07-2010
    Location
    Manchesteer
    MS-Off Ver
    Excel 2007
    Posts
    51

    running sheet code with a button

    Hi,

    I have code that currently runs automatically on selecting the worksheet it is related to.

    I would like to chnage this to it running when i press a button (already inserted) into that sheet. How do i connect the two as it were?

    BTW i'm running office 2007

    Thanks,

    Mark
    Last edited by mark-ainsworth; 04-30-2011 at 02:06 PM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: running sheet code with a button

    Good afternoon mark-ainsworth

    Depends how you inserted the button.

    If you used form controls, you need to take the code, and put it into a macro module, then assign that button to the macro you've created.

    If you used the ActiveX controls you need to double click the button in design mode, then put the code into the window that opens.

    If you're struggling with this, post back with what type of button you're using. It makes a difference.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    02-07-2010
    Location
    Manchesteer
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: running sheet code with a button

    Thanks,

    I'm using the form button.

    I have lots of refernces before to "Me.Range" - how do i reference this now as it isn't 'Me' anymore!

    Thanks,
    Mark

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: running sheet code with a button

    Hi mark-ainsworth

    Could you post your code.

    DominicB

  5. #5
    Registered User
    Join Date
    02-07-2010
    Location
    Manchesteer
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: running sheet code with a button

    Please Login or Register  to view this content.

  6. #6
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: running sheet code with a button

    Hi mark-ainsworth

    You won't need to specify the Me. part of the object as Excel will just assume you want to perform the instruction on the currently active sheet.

    HTH

    DominicB

+ 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