Results 1 to 3 of 3

Thread: How to Switch between Excel Worksheets ??

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    63

    Question How to Switch between Excel Worksheets ??

    Hi!
    I just wanted to know how i could switch between two worksheets in the same workbook (excel file) through the program.

    I understand that we can perform functions only on the active sheet at a time.. Is this true...
    jus wanted to know that if i just assign different worksheets to the activesheet, will it help me to work one sheet then go back to the previous one...

    Or is there a better way to tackle this problem...


    cheers
    Abhilash

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: How to Switch between Excel Worksheets ??

    You can use Sheets("SheetName").Select to select another sheet.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to Switch between Excel Worksheets ??

    Hi Abhilash

    Would suggest to avoid using ".Select". This will take care of most of your error messages

    Directly address the cells if you want to....

    For example

    vb Code:
    1. Sheets("Sheet2").Select
    2. Range("A1").Select
    3. Range("A1").Value = "asdfgh"
    4. Sheets("Sheet3").Select
    5. Range("A1").Select
    6. Range("A1").Value = "aaaa"

    can also be written as

    vb Code:
    1. Sheets("Sheet2").Range("A1").Value = "asdfgh"
    2. Sheets("Sheet3").Range("A1").Value = "aaaa"

    Hope this helps...

    If you have any query, feel free to post it back
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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