If TargetAddress vs If TextBoxes(userform controls)

Flexcel22

Board Regular
Joined
Apr 8, 2016
Messages
52
Hi Everyone,

I remembered working with If TargetAddress which works with pointers. It really amazing using it to do manipulating since all you do is just use a tab key or arrows.

I wondered if this can be applied in a userform.

My case:

I had a userform with many textboxes of around 60. All with the same size and font. There's one textbox which is 6 times bigger in size and font than the remaning textboxes.
I wanted to use the bigger textbox to keep displaying an active smaller textbox content. In this way when I press tab key on my keyboard to jump from textboxt to textbox, the bigger one will automatically display the content of whichever is selected or activated.

Any idea?
 
Thanks for that explanation.
@Flexcel22
Thanks for the feedback and glad I could help.

@My Answer Is This

The script iterates all the textboxes in the userform and retrieves the CurX Property of each TextBox. If the TextBox doesn't currently have the focus, it generates an error. If the textbox has the focus no error is generated... I take advantage of this to know which textbox is currently active.. Once I find the active textbox that has the focus, I just pass its value to the main textbox and exit the iteration.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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