Highlighting a Range on a Userform 
Author Message
 Highlighting a Range on a Userform

I am using a Userform with multiple textboxes to collect
information that is assigned to named ranges on an Excel
spreadsheet.  The ControlSource is set to the Range on the
worksheet for the userform default value.  I would like to
know how to bring the ControlSource value up and have the
active cell highlighted so that the user can simply type
in the new data without deleting the existing text
(similar to a double-click of the mouse on this range).  
The tab key will advance the cursor to the next textbox
and highlight the data but I am not sure how to have the
first textbox come up that way.

Thanks,
Chris



Sat, 03 Dec 2005 20:15:15 GMT  
 Highlighting a Range on a Userform

Quote:
> bring the ControlSource value up

To where? The textbox?

Quote:
> have the active cell highlighted

You want the user to edit in the ControlSource cell and not in the textbox?

Bob Kilmer


Quote:
> I am using a Userform with multiple textboxes to collect
> information that is assigned to named ranges on an Excel
> spreadsheet.  The ControlSource is set to the Range on the
> worksheet for the userform default value.  I would like to
> know how to bring the ControlSource value up and have the
> active cell highlighted so that the user can simply type
> in the new data without deleting the existing text
> (similar to a double-click of the mouse on this range).
> The tab key will advance the cursor to the next textbox
> and highlight the data but I am not sure how to have the
> first textbox come up that way.

> Thanks,
> Chris



Sun, 04 Dec 2005 14:05:01 GMT  
 Highlighting a Range on a Userform
Sorry, maybe this will be a bit more clear.  When the
userform is shown, the textbox(es) are populated with the
values specified by the ControlSource values.  When this
happens, I would like to have the first textbox value on
the userform highlighted so that the user can simply type
in the new data without having to select and delete the
existing data or simply press tab to advance to the next
field and keep the default value from the ControlSource.  
When the Tab key is pressed now, the next textbox is
activated and highlighted as I would prefer.  It's just
the first textbox that does not come in highlighted.

Thanks,
Chris

Quote:
>-----Original Message-----
>> bring the ControlSource value up

>To where? The textbox?

>> have the active cell highlighted

>You want the user to edit in the ControlSource cell and
not in the textbox?

>Bob Kilmer



>> I am using a Userform with multiple textboxes to collect
>> information that is assigned to named ranges on an Excel
>> spreadsheet.  The ControlSource is set to the Range on
the
>> worksheet for the userform default value.  I would like
to
>> know how to bring the ControlSource value up and have
the
>> active cell highlighted so that the user can simply type
>> in the new data without deleting the existing text
>> (similar to a double-click of the mouse on this range).
>> The tab key will advance the cursor to the next textbox
>> and highlight the data but I am not sure how to have the
>> first textbox come up that way.

>> Thanks,
>> Chris

>.



Sun, 04 Dec 2005 14:19:56 GMT  
 Highlighting a Range on a Userform
This works for me:

Private Sub UserForm_Initialize()
   TextBox1.SelStart = 0
   TextBox1.SelLength = Len(TextBox1.Text)
End Sub

Bob Kilmer


Quote:
> Sorry, maybe this will be a bit more clear.  When the
> userform is shown, the textbox(es) are populated with the
> values specified by the ControlSource values.  When this
> happens, I would like to have the first textbox value on
> the userform highlighted so that the user can simply type
> in the new data without having to select and delete the
> existing data or simply press tab to advance to the next
> field and keep the default value from the ControlSource.
> When the Tab key is pressed now, the next textbox is
> activated and highlighted as I would prefer.  It's just
> the first textbox that does not come in highlighted.

> Thanks,
> Chris

> >-----Original Message-----
> >> bring the ControlSource value up

> >To where? The textbox?

> >> have the active cell highlighted

> >You want the user to edit in the ControlSource cell and
> not in the textbox?

> >Bob Kilmer



> >> I am using a Userform with multiple textboxes to collect
> >> information that is assigned to named ranges on an Excel
> >> spreadsheet.  The ControlSource is set to the Range on
> the
> >> worksheet for the userform default value.  I would like
> to
> >> know how to bring the ControlSource value up and have
> the
> >> active cell highlighted so that the user can simply type
> >> in the new data without deleting the existing text
> >> (similar to a double-click of the mouse on this range).
> >> The tab key will advance the cursor to the next textbox
> >> and highlight the data but I am not sure how to have the
> >> first textbox come up that way.

> >> Thanks,
> >> Chris

> >.



Sun, 04 Dec 2005 14:28:10 GMT  
 Highlighting a Range on a Userform
Works for me too - Thanks!

Quote:
>-----Original Message-----
>This works for me:

>Private Sub UserForm_Initialize()
>   TextBox1.SelStart = 0
>   TextBox1.SelLength = Len(TextBox1.Text)
>End Sub

>Bob Kilmer



>> Sorry, maybe this will be a bit more clear.  When the
>> userform is shown, the textbox(es) are populated with
the
>> values specified by the ControlSource values.  When this
>> happens, I would like to have the first textbox value on
>> the userform highlighted so that the user can simply
type
>> in the new data without having to select and delete the
>> existing data or simply press tab to advance to the next
>> field and keep the default value from the ControlSource.
>> When the Tab key is pressed now, the next textbox is
>> activated and highlighted as I would prefer.  It's just
>> the first textbox that does not come in highlighted.

>> Thanks,
>> Chris

>> >-----Original Message-----
>> >> bring the ControlSource value up

>> >To where? The textbox?

>> >> have the active cell highlighted

>> >You want the user to edit in the ControlSource cell and
>> not in the textbox?

>> >Bob Kilmer



>> >> I am using a Userform with multiple textboxes to
collect
>> >> information that is assigned to named ranges on an
Excel
>> >> spreadsheet.  The ControlSource is set to the Range
on
>> the
>> >> worksheet for the userform default value.  I would
like
>> to
>> >> know how to bring the ControlSource value up and have
>> the
>> >> active cell highlighted so that the user can simply
type
>> >> in the new data without deleting the existing text
>> >> (similar to a double-click of the mouse on this
range).
>> >> The tab key will advance the cursor to the next
textbox
>> >> and highlight the data but I am not sure how to have
the
>> >> first textbox come up that way.

>> >> Thanks,
>> >> Chris

>> >.

>.



Sun, 04 Dec 2005 14:34:44 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. highlight range without knowing the range beforehand

2. Create UserForm's ComboBox input range from worksheet range

3. XL2000 userform highlighting text problem

4. Highlighting text on userform

5. How to highlight (select) text in a TextBox in UserForm

6. Highlighting text in a userform's TextBox

7. highlighted range

8. Lookup values in a range and highlight it.

9. Highlighting like names in a range

10. Using VBA to select a highlighted range and paste values to another workbook


 
Powered by phpBB® Forum Software © phpBB Group