Worksheet not active after dialog box closes

SteveRMS

New Member
Joined
Feb 23, 2015
Messages
5
I'm using VBA to display a dialogue box (user form). When I close the dialogue box, the Excel worksheet is not active - the title bar is dimmed. I need to click somewhere on the worksheet to make it active.
I've tried lots of VBA commands to achieve this without success.
What am I missing?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi Steve
Did you put
Code:
unload frmName 'whatever your frmname is
at the end of your code ?
Are you really in RMS ?
 
Upvote 0
Hi Steve
Did you put
Code:
unload frmName 'whatever your frmname is
at the end of your code ?
Are you really in RMS ?

Yes, I put Unload Me in the cmdOK_Button_Click subroutine in the user form.
Yes, I work for RMS at Argyle Street
 
Upvote 0
Some comments here from Tom Ogilvy
Activate Excel worksheet after showing a user form ? | PC Review

In particular, Post #6

Parkes Regional Office....but currently on LSL

Thanks for the suggestion. I checked my code but I don't use the setfocus command.
However I did use it a few weeks ago to try to solve the problem. Here the methods I've tried:
stgTitle = "Microsoft Excel - " & stgTitle
AppActivate stgTitle
Workbooks(stgTitle).Worksheets("Risk register").Activate
Sheets("Risk register").Select
Workbooks(stgTitle).Worksheets("Risk register").SetFocus
CommandBars("ProjectPack risk register").Enabled = True
Application.Run ("PP_RR_Template_Toolbar.PP_RR_Toolbar_Create")
Cells(1, 1).Select

Any other ideas?
 
Upvote 0
Not until I get Excel back up !
What is the current code that's "not working", can you post it, so that hopefully someone else may be able to jump in and assist !
 
Upvote 0
Not until I get Excel back up !
What is the current code that's "not working", can you post it, so that hopefully someone else may be able to jump in and assist !

The code for showing and hiding the dialogue box is straight forward.
The following code displays the dialogue box:
frmPP_RR_Display_Options.Show
The following code is within the user form:
Me.Hide
Unload Me
There's lots of other subsequent code to handle the options selected by the user.
 
Upvote 0
If you are within the userform code...Unload.Me should work fine
But if you aren't you need to refer to the form exactly...Unload Usrfrmname

Also, it sounds like there is still code running in the background, or the Excel application is still running (title bar dimmed)
 
Upvote 0
If you are within the userform code...Unload.Me should work fine
But if you aren't you need to refer to the form exactly...Unload Usrfrmname

Also, it sounds like there is still code running in the background, or the Excel application is still running (title bar dimmed)

Thanks for the ideas.
The Unload.me is within the userform code.
I read through the code again but I can't see any reason why anything might be running in the background.
Is there something in the userform properties that could be causing this problem?
 
Upvote 0
No, once unloaded, that should be it !!
Without seeing the rest of the code, it's hard to guess what it could be !!
Have you tried putting breakpoints in the code and / or stepping through manually.
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

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