Shift focus from a userform to excel

bydesign

Board Regular
Joined
Nov 29, 2003
Messages
184
Hello

How can I shift focus from a visible userform to the excel sheet?

my userform is modeless and
Currently, the last statement in my procedure is...
Sheets("MySheet").Range("B93").Activate

The cell selector is put in the correct place, however the userform still has focus... therefore you must actually click the excel sheet before you can type in the selected cell.

Any ideas on how to programatically shift focus to the excel sheet?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
try
Code:
Sheets("MySheet").Range("B93").select
.
However, the focus stays with the userform I believe until you use "hide" , "unload", or close. I've been wrong before. Dave
 
Upvote 0
Dave

I also went down that road while experimenting...

.activate or .select does not affect the focus.

I have procedures in the userform module, standard module, sheet and workbook modules. When the events in the sheet or workbook are triggered then excel maintains focus...

Thanks for the input, I appreciate your time!
 
Upvote 0
Scott...I'm not sure why you're trying to type into a worksheet cell while you have a userform displayed? Why not just have a textbox on the userform with the control source set as the cell you want to type into while the userform is displayed? Dave
 
Upvote 0
Dave

My userform is realatively complex... I am deveoping an app that works with alot of technical data that is either developed from the input on the userform or modified on the sheet based on userform input. These features are all tied into reporting routines for electrial inspectors and material orders and material forcasting.

Basically a complex toolbar... I actually wanted to make 1 or more tool bars for this but I couldn't come up with a user friendly setup...

[/img]
 
Upvote 0
Have you set the ShowModal property of the userform to false? Or is there something else maybe going on that I missed with the question.
 
Upvote 0
Tom

Yes, the "ShowModal" property is set to "false"

This works exactly as desired... i.e. I can work with the user form or the excel sheet at will...

After I run a procedures after userinput on the userform, I set the active cell the user should be working with...

This works to visually show the user where to go... but if the user wishes to type in this cell, they actually have to click on it (or the excel window itself) in order to change focus to excel...

Basically I'm looking to prgrammatically shift focus to excel.

for a userform or control it's easy... i.e. userform.setforcus , however there isn't a setfocus method for the application..

Microsoft knowledgebase says this is designed this way becasue excel is the parent object...

I'm hopeing to find a workaround...

Thanks for the input.
 
Upvote 0
What version of Excel are you using? Excel97 by any chance? I cannot duplicate your problem as I understand it. I am using Excel 2002 on XP.

To use a worksheet when a userform is active, you need Excel 2000 or above, and you need to set the form's ShowModal property to False. The form will show unless you include the statement somewhere
UserForm1.Hide
and then Unhide it again when you are ready. You probably already knew that. If you are using a version after 97 then either I still don't understand the issue (always a possibility), or there is something else happening in your application.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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