+ Reply to Thread
Results 1 to 13 of 13

how to activate selected sheet

  1. #1
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    how to activate selected sheet

    dear all,
    good day

    here below you will find an extract of my userform .
    everithing works good execpt the activation of that precise worksheet.
    if i use the userform inside the selected sheet it works fine,when i try to use it referring to another sheet i get stack .
    i have try different way but no one is working fine :



    Please Login or Register  to view this content.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: how to activate selected sheet

    Highlight the line where you are having problems and specify the exact error. Would be best if you also posted the workbook.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: how to activate selected sheet

    Hi Lorenzo
    Assuming this is referring to the current workbook & only the one workbook is open & assuming that worksheet "744 OCV PMC" is Sheet 1, I would add a Dim for the worksheet, set it as Sheet 1 & refer to it with a with statement like the example below. I normally set my sheets by number so I can rename them without having to change any VBA code. Using Activesheet & Activeworkbook can lead to all sorts of unwanted problems, it's best to qualify them by name & refer to the name in the code

    Please Login or Register  to view this content.
    Hope this helps

  4. #4
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    Dear all,

    tks for help but unfortunately problem persist .

    basicaly when i open the user form from the sheet i need to chk it works.
    when i open the user form and try to chk other sheets i get a debug on the line of the sheet i want to chk with below statement:
    "unable to match property of the worksheet function class".
    as suggested by skywriter i have attched my worksheet.
    many tks


    tks to all for help

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: how to activate selected sheet

    Please specify exactly what you are doing when the problem happens. You are making generalized statements, you have many sheets and a statement like this makes it difficult to help you. What sheet are you on when it happens? How do you go about opening the form? The more detail the better.
    basicaly when i open the user form from the sheet i need to chk it works.

  6. #6
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    dear skywriter,sorry...my english is also poor ..... i wll try to explane :

    when you opn the workbook go to the sheet called"master" ,push the only button you have and the userform will popup.
    fill all the 4 x combobox (choose casually) then hit button "calcola" (calculate) ..at that point i have trouble because the function do not activate the sheet i need to chk into(all other sheets are the diffenrent tipe of table the userform need to refer based on all 4 x combobox selection).
    each of that combobox option once selected should refer and activate a precise sheet (this is the point i need as selected sheet is not activating)and then will chk the table and give you the result with a msgbox
    ..hope now is a bit more cleare ...tks again for your patience....

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: how to activate selected sheet

    Does this work?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: how to activate selected sheet

    In addition to Norie's code you have some data errors.
    Regarding sheet 744 OCV FG

    You have these values that you want to match.
    Cell A1650 contains 4VERT
    Cell A1651 contains FG

    The cells you are looking for a match in contain 1 vert, 2 vert etc.
    The other cells you want to match are all single letters. No FG. You have your match code set to exact match so when I run Norie's code on this sheet I get an error because there is no match. I didn't check other sheets for this problem, but I thought you should be aware of it.

  9. #9
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    Dear skywriter,tomorrow at work I wll chk.....cells a1650 and a1651 should change based on the combobox selection.....the data that you have there are my past tentative based on the combobox selection.....2x combobox selection goes there....than that value is match inside the table at the top......I also need to add a function that wll clear that cells after the user form is closed.....in the meantime tks to all for help...I let you know tomorrow...best regards

  10. #10
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: how to activate selected sheet

    I just pointed something out that you should be aware of. Maybe it's an issue maybe not.
    The person who deserves a real thanks is Norie post#7.
    Norie has helped me on another board, always a great help.
    Last edited by skywriter; 03-04-2015 at 03:13 PM.

  11. #11
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    Yes sure .....many many tks ..most probably Will be another thinks I wllneed to fix tomorrow .....again tks you both guys for yr professional help..appreciated so much

  12. #12
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    dear Nori,skywriter

    based on your suggestions i have modify the codes .
    now it works perfectly for all things except one .
    "only" when selecting from combobox (first left top one) "748 all" and select then from
    the second combobox "prf" i get a bug and the combobox 4 will not populate .

    here attchd the code ,highlited in red where i get the error:

    Please Login or Register  to view this content.
    for your reference i have attached the new sheet with the changes i have made ....tks again

  13. #13
    Forum Contributor
    Join Date
    02-14-2015
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    110

    Re: how to activate selected sheet

    dear guys,

    just now solved the problem...i don't know why but renaiming that sheet with a different name make it works .
    all ok now ...i wll close the post.....would like to say big thk to skywriter and Norie for their precious help .
    have a good day

    rgds
    Lorenzo

+ 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. Code to Activate a sheet 1 [IF] Userform box is "X" if not Activate Sheet 2
    By Invicta084 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-07-2014, 08:50 AM
  2. Activate worksheet based on a column value selected from validation list
    By jnbroek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 11:05 PM
  3. Activate Print option with a userform where selected Sheet check box option available..
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 08:19 AM
  4. Activate Userform When A Cell is Selected
    By SamuelT in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-17-2008, 10:51 AM
  5. activate or deactivate a cell based on the option selected in validation list
    By techfutura in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-15-2008, 06:55 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