+ Reply to Thread
Results 1 to 6 of 6

select worksheet and run macro

  1. #1
    Registered User
    Join Date
    01-31-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    select worksheet and run macro

    Hi,

    I am trying to run some code when a worksheet is selected.

    I'm doing this using a macro currently (code below), but this requires that i use a quick menu button and i would like to make it a form button and assign a macro to it (so i can distribute the file without everyone having to create a menu button).

    I would like to replace (or modify) the code below to select any sheet other than the ones named "a" and "b".

    Can someone help modify this code please ?

    Many thanks,

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: select worksheet and run macro

    Your code does not show that sheets a & b have been selected.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-31-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: select worksheet and run macro

    that's right, i'm looking to change this code to be able to do that, sorry, i didn't explain very well.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: select worksheet and run macro

    @arlu1201

    Please read the post carefully (if necessary twice or more) before responding and misinterpreting the question.



  5. #5
    Registered User
    Join Date
    01-31-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: select worksheet and run macro

    i'm pretty sure i can use worksheets(1).select, but not sure how to mod the code above to replace.

    Thanks.

  6. #6
    Registered User
    Join Date
    01-31-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: select worksheet and run macro

    anyone please help ?

+ 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