Button On Userform To Activate Woorksheet

M

Mathew

Good evening all,
Hopefully someone may be able to help me here, I have had a look through Google but to no avail.

I have created a userform which acts as a splash screen, on which I have placed Command Buttons.
I have one which exits the workbook - this works fine.
However I am trying to code the other buttons to go to & activate a specific worksheet within the workbook,
as well as unloading the userform (splash screen) - ie when the button is clicked the userform diasppears,
and cell A1 is selected in the required worksheet.

Any help here, would be most appreciated. I also seem to be getting confused in which module the code should go.

Cheers
Mathew
 
B

Bob Phillips

Hi Mathew,

Worksheets("Sheet2").Activate
Range("A10").Select
Unload me

should get you started.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Mathew said:
Good evening all,
Hopefully someone may be able to help me here, I have had a look through Google but to no avail.

I have created a userform which acts as a splash screen, on which I have placed Command Buttons.
I have one which exits the workbook - this works fine.
However I am trying to code the other buttons to go to & activate a
specific worksheet within the workbook,
as well as unloading the userform (splash screen) - ie when the button is
clicked the userform diasppears,
and cell A1 is selected in the required worksheet.

Any help here, would be most appreciated. I also seem to be getting
confused in which module the code should go.
 
M

Mathew

Hi Bob,

Cheers, I have tried this, & cannot get it to work.
I have the CommandButton1_Click() code in the Userform code module, which I think is the problem,
I have been using JWalks VBA book, and I am under the immpression that a worksheet event must be placed in the worksheet module.
Any further advisce would be welcome
Cheers
Mathew

Hi Mathew,

Worksheets("Sheet2").Activate
Range("A10").Select
Unload me

should get you started.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Mathew said:
Good evening all,
Hopefully someone may be able to help me here, I have had a look through Google but to no avail.

I have created a userform which acts as a splash screen, on which I have placed Command Buttons.
I have one which exits the workbook - this works fine.
However I am trying to code the other buttons to go to & activate a
specific worksheet within the workbook,
as well as unloading the userform (splash screen) - ie when the button is
clicked the userform diasppears,
and cell A1 is selected in the required worksheet.

Any help here, would be most appreciated. I also seem to be getting
confused in which module the code should go.
 
B

Bob Phillips

Mathew,

This is not worksheet event code. I meant it to be added to the
commandbutton code, in the userform, like so

Private Sub CommandButton1_Click()
Worksheets("Sheet2").Activate
Range("A10").Select
Unload me
End Sub
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Mathew said:
Hi Bob,

Cheers, I have tried this, & cannot get it to work.
I have the CommandButton1_Click() code in the Userform code module, which I think is the problem,
I have been using JWalks VBA book, and I am under the immpression that a
worksheet event must be placed in the worksheet module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top