Set Focus

llmiller

New Member
Joined
May 18, 2003
Messages
4
I have developed many Excel 97 spreadsheets over the last few years utilizing userforms, textboxes, and 'setfocus' without any problem. Recently, I upgraded to Excel 2000 (I know... I am still a few updates behind) and now have encountered a problem with 'setfocus'. It simply does not seem to work.

Can anyone offer an insight into what might be causing this problem?

Thanks,

Logan
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
DK,

An example of code follows. This code has worked perfectly in Excel 97 for over two years. After the upgrade to Excel 2000, it fails to perform.

Private Sub CommandButton2_Click()
Range("e2,f2").Value = ""
Me.Hide
Find_Subtotal.TextBox1.SetFocus
Find_Subtotal.Show
End Sub

Thanks,

Logan
 
Upvote 0
Logan,

Is the ShowModal property of the Find_Subtotal true or false? My guess is that it's currently false. Try changing it to true and see what happens.
 
Upvote 0
dk

Thanks for the suggestion. However, the ShowModal property of the form is set to 'True'.


Logan
 
Upvote 0
In that case I'm not sure what could be wrong. I tried out your code and it worked for me. If you want, you can send me a sample workbook with the stuff that doesn't work.
 
Upvote 0
dk,

I played around with this a little further and created a brand new workbook in 97 with a simple userform and textboxes. The setfocus routine worked fine in both Excel 97 and 2000.

It appears that some sort of anomaly must have occurred during the creation of the original spreadsheets in Excel 97 a couple of years ago. I can't find anything else that explains the problem.

Thanks again for all your assistance. Much appreciated.

Logan
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,322
Members
451,696
Latest member
Senthil Murugan

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