Relocate Tab Position via Code?

Rufus Clupea

Board Regular
Joined
Feb 11, 2019
Messages
85
Related to my second question in a previous thread:
Is there a way to tab (key) directly from the last TabStop on one page of the MultiPage to the first TabStop on the next page without manually clicking on the MultiPage tab and the first TabStop on each subsequent page?
Is there any way to change the tab position via VBA code? Here's the situation:

I have a Frame containing 8 OptionButtons and 1 SpinButton/Label combination.
If the SpinButton is clicked, the OptionButtons are all "zeroed out" (.Value = False) and the SpinButton does its thing.

If one of the OptionButtons is subsequently clicked, the SpinButton is zeroed out, and the OptionButtons do their thing.

This all works, but the tab position remains on the SpinButton, which could be confusing to an uninitiated User. (At a size of 10 x 18, the SpinButton is rather small; large enough to manipulate by mouse or keyboard, but small enough that the tab position highlight could be missed.)

I'd like to move it (have it automatically move) to the subsequently chosen OptionButton, so the TabStop progression can then continue normally.

Anyone know any way this can be done via code?

TIA
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Why don't you just set the focus to the object that you want as part of the code that was just executed, and from there the TabIndex order will takeover. Something like this...

Code:
Me.ListBox2.SetFocus
 
Upvote 0
(A few minutes later...)

Yes, that seems to work. Took me a few to learn about SetFocus; it's not listed as an object property (I spoze because it's a method—still not comfortably clear with the difference(s)), it's not in either of my VBA books, and deciphering MS Docs seems to require a degree in Rocket Science/Brain Surgery...

But I got there! :cool:

Thanks again!
 
Upvote 0
Happy to help, I am glad it worked for you. I actually learned it when I was teaching myself Access.

Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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