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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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
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,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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