ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Goto Previous worksheet (https://www.excelbanter.com/excel-programming/337791-goto-previous-worksheet.html)

meb081505

Goto Previous worksheet
 
I've programmed a button to open/go to a hidden worksheet. On the hidden
worksheet, I've coded a button to hide it again. But how do I get the button
to take me back to the original worksheet (rather than going to the one next
to the hidden sheet)?

meb081505

Goto Previous worksheet
 
Actually, let me clarify that the "open/go to hidden worksheet" button is on
a number of different worksheets, so simply coding the button to go back to a
specific worksheet will not do. It needs to remain generic and go back to
the worksheet that opened it in the first place. I hope this makes sense . .
..

"meb081505" wrote:

I've programmed a button to open/go to a hidden worksheet. On the hidden
worksheet, I've coded a button to hide it again. But how do I get the button
to take me back to the original worksheet (rather than going to the one next
to the hidden sheet)?


STEVE BELL

Goto Previous worksheet
 
One way is to create a Public variable as Integer

Than in you open/goto hidden worksheet you can set the variable = to the
active sheet index
x = activesheet.index

Than in your code to go back to the orginal (calling) worksheet, use
Sheets(x).Activate
or
Sheets(x).Select

Since x is declared as Public - it will retain it's value until it is
changed or the workbook is closed.

--
steveB

Remove "AYN" from email to respond
"meb081505" wrote in message
...
Actually, let me clarify that the "open/go to hidden worksheet" button is
on
a number of different worksheets, so simply coding the button to go back
to a
specific worksheet will not do. It needs to remain generic and go back to
the worksheet that opened it in the first place. I hope this makes sense
. .
.

"meb081505" wrote:

I've programmed a button to open/go to a hidden worksheet. On the hidden
worksheet, I've coded a button to hide it again. But how do I get the
button
to take me back to the original worksheet (rather than going to the one
next
to the hidden sheet)?





All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com