Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Custom Userforms

I want to create a userform that shows when a particular cell is selected on
a worksheet. Then I need a textbox also on the userform that will only allow
50
characters to be entered, and I would like to be able to show the user how
many characters they have used while they are typing in the text box, like
something that shows 0/50 and as they type it would change 16/34. Is there a
way these actions can be done?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Custom Userforms

Use the change event of the textbox to update a label and limit the number
of characters. It fires on each key entry.

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
I want to create a userform that shows when a particular cell is selected

on
a worksheet. Then I need a textbox also on the userform that will only

allow
50
characters to be entered, and I would like to be able to show the user how
many characters they have used while they are typing in the text box, like
something that shows 0/50 and as they type it would change 16/34. Is there

a
way these actions can be done?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Custom Userforms

Thanks, that will help with the 50 characters, now is there a way to get the
userform to automatically open when a particular cell on a worksheet is
selected? For arguments sake let's say Range("A1").

"Tom Ogilvy" wrote:

Use the change event of the textbox to update a label and limit the number
of characters. It fires on each key entry.

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
I want to create a userform that shows when a particular cell is selected

on
a worksheet. Then I need a textbox also on the userform that will only

allow
50
characters to be entered, and I would like to be able to show the user how
many characters they have used while they are typing in the text box, like
something that shows 0/50 and as they type it would change 16/34. Is there

a
way these actions can be done?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Custom Userforms

Use the selection change event.

Right click on the sheet tab and select view code.

In the left dropdown at the top of the module select Worksheet
in the right dropdown at the top of the module select SelectionChange

this will place the declaration in the module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

you can put your code he

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.Address = "$A$1" then
Userform1.Show
End if
End Sub

--
Regards,
Tom Ogilvy



"jnf40" wrote in message
...
Thanks, that will help with the 50 characters, now is there a way to get

the
userform to automatically open when a particular cell on a worksheet is
selected? For arguments sake let's say Range("A1").

"Tom Ogilvy" wrote:

Use the change event of the textbox to update a label and limit the

number
of characters. It fires on each key entry.

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
I want to create a userform that shows when a particular cell is

selected
on
a worksheet. Then I need a textbox also on the userform that will only

allow
50
characters to be entered, and I would like to be able to show the user

how
many characters they have used while they are typing in the text box,

like
something that shows 0/50 and as they type it would change 16/34. Is

there
a
way these actions can be done?






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Custom Userforms

Thanks. Can you also step me through the updating the label. I know how to
set it up to limit the number of characters allowed in the textbox.

"Tom Ogilvy" wrote:

Use the selection change event.

Right click on the sheet tab and select view code.

In the left dropdown at the top of the module select Worksheet
in the right dropdown at the top of the module select SelectionChange

this will place the declaration in the module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

you can put your code he

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.Address = "$A$1" then
Userform1.Show
End if
End Sub

--
Regards,
Tom Ogilvy



"jnf40" wrote in message
...
Thanks, that will help with the 50 characters, now is there a way to get

the
userform to automatically open when a particular cell on a worksheet is
selected? For arguments sake let's say Range("A1").

"Tom Ogilvy" wrote:

Use the change event of the textbox to update a label and limit the

number
of characters. It fires on each key entry.

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
I want to create a userform that shows when a particular cell is

selected
on
a worksheet. Then I need a textbox also on the userform that will only
allow
50
characters to be entered, and I would like to be able to show the user

how
many characters they have used while they are typing in the text box,

like
something that shows 0/50 and as they type it would change 16/34. Is

there
a
way these actions can be done?









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Custom Userforms

Public bBlockEvents as Boolean


Private Sub Textbox1_Change()
Dim cnt as Long
if bBlockEvents then exit sub
cnt = len(Textbox1.Value)
if cnt 50 then
bBlockevents = True
me.Testbox1.Value = Left(Textbox1.Value,50)
me. label1 = "50/50"
bBlockEvents = False
else
me.label1 = cnt & "/50"
end if
End Sub

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
Thanks. Can you also step me through the updating the label. I know how to
set it up to limit the number of characters allowed in the textbox.

"Tom Ogilvy" wrote:

Use the selection change event.

Right click on the sheet tab and select view code.

In the left dropdown at the top of the module select Worksheet
in the right dropdown at the top of the module select SelectionChange

this will place the declaration in the module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

you can put your code he

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.Address = "$A$1" then
Userform1.Show
End if
End Sub

--
Regards,
Tom Ogilvy



"jnf40" wrote in message
...
Thanks, that will help with the 50 characters, now is there a way to

get
the
userform to automatically open when a particular cell on a worksheet

is
selected? For arguments sake let's say Range("A1").

"Tom Ogilvy" wrote:

Use the change event of the textbox to update a label and limit the

number
of characters. It fires on each key entry.

--
Regards,
Tom Ogilvy


"jnf40" wrote in message
...
I want to create a userform that shows when a particular cell is

selected
on
a worksheet. Then I need a textbox also on the userform that will

only
allow
50
characters to be entered, and I would like to be able to show the

user
how
many characters they have used while they are typing in the text

box,
like
something that shows 0/50 and as they type it would change 16/34.

Is
there
a
way these actions can be done?









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Userforms jnf40 Excel Discussion (Misc queries) 0 February 15th 06 03:41 PM
Userforms Ernst Guckel[_4_] Excel Programming 3 March 24th 05 12:13 AM
userforms Fretsa Excel Programming 1 July 27th 04 12:52 AM
Custom userforms momiage Excel Programming 2 December 14th 03 01:25 AM
userforms again... Jo[_4_] Excel Programming 3 September 21st 03 12:31 AM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"