Closing UserForm on arrival at selected sheet.

Jim Milligan

New Member
Joined
Feb 1, 2019
Messages
2
Hi All,
I wonder if youcan help me out with what I suspect is a simple piece of coding which I cannotfigure out.
The code belowis on a button on a UserForm on a worksheet that I call ‘Control’.
It allows me tomake a selection from a populated ListBox on the same form and works wellenough, but with a problem.
The code carriesme to the selected sheet, but then the UserForm sits in front of it and stops me accessingthe sheet. If I close the UserForm manually I am carried back to the ‘Control’sheet.
What I’d liketo be able to do is click the button, go to the selected sheet without theUserForm being there, and use the sheet’s ‘Show’ and ‘Clear’ buttons to work onthe sheet. On completion I’d like to use a ‘Return’ button on the selectedsheet to go back to the ‘Control’ and UserForm sheet to make another selection.
Your advicewould be appreciated
Best regards
Jim
**************************************************************************************
Private SubCommandButton1_Click() ' Selects sheet to practice chord
' WORKING - BUT NEEDS ATTENTION TO [FONT="Arial",sans-serif]BE[SIZE=2]HAVIOUR OF USERFORM[/SIZE][/FONT][/COLOR]
[COLOR=#008000][SIZE=2][/SIZE][/COLOR][COLOR=#008000][SIZE=2][FONT="Arial"] ' i.e. HOW TO MAKE IT DISAPPEARBUT STILL STAY[/FONT][/SIZE] ON SELECTED SHEET,

' AND ALLOWACCESS TO SHOW, CLEAR etc BUTTONS.
Select CaseListBox1.ListIndex
Case "-1"
MsgBox "No Chord Selected"
Case "0"
Sheets("A").Select
Case "1"
Sheets("D").Select
Case "2"
Sheets("E").Select
Case "3"
Sheets("G").Select
End Select
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,
I appreciate that it looks very odd replying to my own question, but I have now got a workable answer.
The solution looks to lie in the 'SetModal' property of the UserForm - set it to false and the underlying sheet is accessible.
Apologies to anyone whose time I have wasted.
best regards
Jim
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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