Select Text in TextBox

B

ben

I have a userform with four text boxes. When a user activates the Enter event
for any text box my code places a certain value in that box. That part works
fine, however I want it to also select the text once it is entered
programmatically. THAT part does not work, no matter what I have seemed to
try.

Private Sub py4_Enter()
'Change text then....
with py4
..selstart = 0
..sellength = len(.text)
..setfocus
end with
end sub


even moving the setfocus or REmoving it helped none. Am I missing something
simple here?
 
B

ben

it loops through the other textboxes adds their values together, then
subracts that amount from a given total. THen plugs that amount into the text
box that was just clicked. The looping does not in anyway setfocus or select
the textboxes being read.
 
B

ben

absolutely nothing gets selected. thank you but I found out i had a better
way to accomplish the desired ends, still can't highlight, but since i
couldn't get it working i just programmed something else. Thank you however
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top