Is there a VBA code which returns to the previous sheet??

zilch4ry

Board Regular
Joined
Feb 27, 2011
Messages
76
Hi,

I have created a macro which finishes the time spent on a specific worksheet by cutting information entered into cells and places them on a different worksheet (the worksheet is only used to create a new account). This "New Member" worksheet can be found by using either of two macros- one located on the "Home" worksheet and one located on the "Order" worksheet.

My question is, is that once the user has hit finish I don't know where to relocate them back to, because they can enter this worksheet from two completely different worksheets.

Is there a code which sends the user back to the page they were on originally?


If that made any sense to anybody, help would be greatly appreciated


Thanks,



Tom
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
You need to store the original worksheet at the top of the macro.

Code:
Dim origWS As Worksheet

Set origWS = ActiveSheet

'Your code

origWS.Activate
 
Upvote 0
I might have got this wrong, but there are two worksheets that the user can choose from- does this only allow me to select one worksheet the user can return to?
 
Upvote 0
How does the focus end up on a different worksheet from where it was initiated?

It might be possible to prevent that happening and still get things done.

ie do what you want without activating another worksheet
 
Upvote 0
This might be a little confusing but this is what ive done:

I was told to produce an pizza ordering spreadsheet for ICT

One of the specifications for spreadsheet was to keep a customer database

To create the customer database i have another worksheet where a customer can enter their details and then click a "Finish" macro button- this cuts all cells and pastes the information into the next free row on the customer database worksheet

To get to the worksheet where users enter there details ("New Member" worksheet) i have two ways- one way it to get there using a macro button found on the "Order" worksheet and another way which is on the "Home" worksheet.

The problem i am having is that when the customer clicks the "Finish" macro on the "New member" worksheet i don't know where to relocate them, because they can come from either one of the two worksheets.

So is there a way to just say go back to the worksheet they were on, before they were relocated to the "New Member" worksheet.


;) is this even possible?
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top