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
Re: How to Switch between Excel Worksheets ??
You can use Sheets("SheetName").Select to select another sheet.
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:
Sheets("Sheet2").Select
Range("A1").Select
Range("A1").Value = "asdfgh"
Sheets("Sheet3").Select
Range("A1").Select
Range("A1").Value = "aaaa"
can also be written as
vb Code:
Sheets("Sheet2").Range("A1").Value = "asdfgh"
Sheets("Sheet3").Range("A1").Value = "aaaa"
Hope this helps...
If you have any query, feel free to post it back :)