Results 1 to 5 of 5

Thread: vb for excel

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Argentina, Buenos Aires
    Posts
    38

    vb for excel

    I am using VB fo Excel. I want to activate a sheet of a workbook. The name of the workbook is entered as data ( thanks to your help) with no problem. Now I want to Activate a worksheet of the above workbook, also entered as data. I tried several alternatives to enter this sheet as data, but all failed. Any help?. Thank you. Norah

  2. #2
    Addicted Member
    Join Date
    Dec 2001
    Posts
    158
    MyString = "sheet1"

    Worksheets(MyString).activate

  3. #3
    Member
    Join Date
    May 2004
    Location
    Dubai, United Arab Emirates
    Posts
    33
    Hi Norah,

    On the Excel sheet.

    Press Alt + F11

    Go to Insert | Module

    Type This:

    Sub Active()
    MyString = "BOQ"

    Worksheets(MyString).Activate
    End Sub


    Where BOQ is the sheet name that you want to Activate. You can replace it with any other name that you have.

    Now Press Alt + F11 again to come back to excel and from the Tools | Macro run Active.


    Plus you can assign this to a button as well to avoid going to Tools | Macro.

    Best Regards,

    S h a n

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Am I missing something or isn't it simpler to just click the sheet
    tab at the bottom of the workbook to activate that sheet instead
    of creating a toolbar button to simulate the sheet tab click?

    Or is this being used in automation?

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Member
    Join Date
    May 2004
    Location
    Dubai, United Arab Emirates
    Posts
    33
    well, people like automation these days.

    Assume you have 70-80 sheets on a workbook. This might help there. isn't it ?

    Best Regards,

    S h a n

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width