how to refer a sheet in a code
activesheet is working but when i use Sheets("Sheet3") or WorkSheets("Sheet3").
It throws "Run time Error 9"
Help its gettin me nuts
how to refer a sheet in a code
activesheet is working but when i use Sheets("Sheet3") or WorkSheets("Sheet3").
It throws "Run time Error 9"
Help its gettin me nuts
Use Worksheets("Sheet3") and not Sheets("Sheet3")
If you don't have a "Sheet3" then you can use a number in the parenthesis.
Worksheets(1) is the farthest one on the left.
If you want to check it's name you can call it by using Worksheets(1).name.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
Can you explain me some standard procedure for referring to worksheets, workbook because sometimes the references work fine when i do it in my system but when i do it on another system it throws an error.
Sheets("Sheet3") will work if you have a sheet with that name in the active workbook-unless the code is in the thisworkbook module of a workbook in which case the sheet must be in the same workbook as the code unless you specify which workbook you are referring to (which is better anyway)
Josie
if at first you don't succeed try doing it the way your wife told you to
okk thanks for tip i will try it....
but this code which was working perfectly fine but now is giving runtime error 32809 application defined or object defined error.
Private Sub CommandButton3_Click()
Worksheets(ActiveSheet.Index + 1).Activate
End Sub
can you post a workbook that exhibits that problem? are there any chart sheets in the workbook
If your ActiveSheet is the last sheet you will get an error with your code. Perhaps this is why it works sometimes and not others?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks