ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I load a user form from within a worksheet subroutine? (https://www.excelbanter.com/excel-programming/398805-how-can-i-load-user-form-within-worksheet-subroutine.html)

Doug

How can I load a user form from within a worksheet subroutine?
 
I can load it from a module or from a forms routine, but not from a worksheet
routine. I want to be able to have it load when a command button (residing
on the worksheet) is clicked.

JRForm

How can I load a user form from within a worksheet subroutine?
 
Doug,

Place this behind the command button on the sheet

Private Sub CommandButton1_Click()
Load UserForm1
End Sub

"Doug" wrote:

I can load it from a module or from a forms routine, but not from a worksheet
routine. I want to be able to have it load when a command button (residing
on the worksheet) is clicked.


Doug

How can I load a user form from within a worksheet subroutine?
 
It didn't work. I keep getting a run-time error code, "1004": Application
defined error.

"JRForm" wrote:

Doug,

Place this behind the command button on the sheet

Private Sub CommandButton1_Click()
Load UserForm1
End Sub

"Doug" wrote:

I can load it from a module or from a forms routine, but not from a worksheet
routine. I want to be able to have it load when a command button (residing
on the worksheet) is clicked.


Doug

How can I load a user form from within a worksheet subroutine?
 
JRForm,

I did get it to work. What I had to do was to include a call for a Load/Show
subroutine that I located in the Module. I can now Load/Show my UserForm.

Thank you all,
Doug

"JRForm" wrote:

Doug,

Place this behind the command button on the sheet

Private Sub CommandButton1_Click()
Load UserForm1
End Sub

"Doug" wrote:

I can load it from a module or from a forms routine, but not from a worksheet
routine. I want to be able to have it load when a command button (residing
on the worksheet) is clicked.


JRForm

How can I load a user form from within a worksheet subroutine?
 
Doug,

The code I gave you should have worked if you placed it in the code module
for the button. However, I did assume you already had the UserForm1.
I am glad you have it working. :)

"Doug" wrote:

JRForm,

I did get it to work. What I had to do was to include a call for a Load/Show
subroutine that I located in the Module. I can now Load/Show my UserForm.

Thank you all,
Doug

"JRForm" wrote:

Doug,

Place this behind the command button on the sheet

Private Sub CommandButton1_Click()
Load UserForm1
End Sub

"Doug" wrote:

I can load it from a module or from a forms routine, but not from a worksheet
routine. I want to be able to have it load when a command button (residing
on the worksheet) is clicked.



All times are GMT +1. The time now is 08:48 AM.

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