+ Reply to Thread
Results 1 to 21 of 21

Macro to find the sheet name

  1. #1
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Post Macro to find the sheet name

    hi,
    I have the below macro which is working fine. But the problem is it is only taking as it is in the sheet name. I mean it case sensitive. If I give pa02 instead of PA02 it is telling no sheets. It should not be line that. it should work either if i type in small letters or caps letters or the combination. One more thing i want is, if i have multiple sheets which have 02 it should to to the next sheet which contains the string 02. I mean i need next button as well. It should be floating on every sheet so that i can search for the sheet on every sheet and go to the required sheet. I hope I am clear.
    Please hlep.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to find the sheet name

    I don't see any reason this won't work, I've tested it on my system and it activates the correct sheets regardless of capitalization.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Thank you for your reply. I tried the macro which you gave now. But if i am finding a part of the sheet name it is not working.
    I mean if the sheet name is 20144_OOW and if i am searching for 20144 it says "sheet doesnot exists" and one more thing is if i have another sheet which has 2014(Ex: 20144 error) then it should give me another button "Next" by clicking on it should take me to the next 20144 containing sheet. Pleae help....

  4. #4
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Please help

  5. #5
    Registered User
    Join Date
    08-22-2012
    Location
    Zagreb, Croatia
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Macro to find the sheet name

    hi kishoremcp,
    try this code...


    Please Login or Register  to view this content.
    regards,
    If a post helps press star sign 4 my reputation

  6. #6
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    No, it is not working

  7. #7
    Registered User
    Join Date
    08-22-2012
    Location
    Zagreb, Croatia
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Macro to find the sheet name

    Hi again,
    if you have upper/lower case problem, following code should be fix:

    Please Login or Register  to view this content.
    This procedure you have to place in Module1 object if you need to trigger macro from any sheet.
    It's work perfectly in my Excel 2003.

    Regards,

  8. #8
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    It is working but if i have jam in another sheet name it is not going to that pirticular sheet. it stops at the first page

  9. #9
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Any more help

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to find the sheet name

    What other help do you need?

  11. #11
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    The below macro is working for some extent. I mean if i have two sheets 144 and 20144 then it is searching for 144 only and if i again search for 144 it only shows one sheet only that is 144 but it will not show you 20144.so i want another button where i can click on next which will find the next sheet name which should show me the sheet 20144 as it also contains 144. At the same time i am also having the upper case and lower case problem while searching.Is it possible to avoid that also. Please help me. Attaching the file also again.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macro to find the sheet name

    What do you mean by "Show" ?
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Yes. this is working good for upper case and lower case. Now for my second question which is about the second sheet with same name followed by some different extension. Like (20144 is a sheet and 144 error is another sheet) if i search for 144 it will give either 20144 or 144. What if i want to go with the next sheet other than the selected one ( i mean if is shows 144 errors sheet if i search for 144 and i want to go for 20144 then what need to be done). i hope i am clear. please help me.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macro to find the sheet name

    No idea about what you are asking.

    Wait for someone else to come in.

  15. #15
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    If I run the above macro I am having two buttons. One is OK and the other is Cancel. I want to have another button with name as Next and it should search the next sheet name with the same search string which i enter. I think i am clear now

  16. #16
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Any suggestions

  17. #17
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    I am looking for help

  18. #18
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Macro to find the sheet name

    Still looking for help

  19. #19
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Macro to find the sheet name

    I'm not an VBA export.

    When I run the macro you provided I get the right worksheet.

    If I input an anvalid value (e.g. 2014) it finds the right worksheet (20144)

    It only finds 1 worksheet while running the macro, but that is what you want (i suppose).

    So, i can understand that you have no other reaction, because to my opinion you have the solution you want,

    Or you are not clear what you want (so other members cant help you).
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  20. #20
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to find the sheet name

    Hi, kishoremcp,

    maybe you have a look at this approach which uses a VBA-Userform with one Textbox (for the search), one Listbox for the display of either all or searched sheetnames and three buttons (one for searching or restoring the sheetnames, one for activating a selected sheet, one to close the form).

    Code behind the Userform:
    Please Login or Register  to view this content.
    Code is started by opening the workbook via Workbook_Open:
    Please Login or Register  to view this content.
    Right now the sheetname of the one activated will be deleted from the listbox (may be restored via SheetNames).

    HTH,
    Holger
    Attached Files Attached Files
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  21. #21
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to find the sheet name

    Hi, kishoremcp,,

    please change the MultiSelect for the Listbox from 1 - frmMultiSelectMulti to 0 - frmMultiSelectSingle (I missed that one). There won´t be a runtime error but you will be led to the sheet which was the last to be selected. By changing the Multiselect there will only one choice available.

    Ciao,
    Holger

+ 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