PC Review


Reply
Thread Tools Rate Thread

change event help

 
 
=?Utf-8?B?ZXJuaWU=?=
Guest
Posts: n/a
 
      22nd May 2007
Hi all,

i have my userform pull up info from cell on initializing, so sometimes the
code below works and sometimes it doesn't. what i need to do is use a similar
code to delete the unwanted characters on the change event.


Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 8 To 10, 13, 27 'Control characters
Case 45, 46 'negative and period
If KeyAscii = 45 Then 'hypen/negative
If Len(Trim(txtItemFob.Text)) > 1 Then
Beep
KeyAscii = 0
End If
End If
Case 48 To 57 'numbers
Case Else 'Discard anything else
Beep
KeyAscii = 0
End Select
End Sub

--
help a friend help you
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QUtwaGlkZWx0?=
Guest
Posts: n/a
 
      22nd May 2007
What is the exact problem? Do you need to delete a cell or are you just
getting error messages?

"ernie" wrote:

> Hi all,
>
> i have my userform pull up info from cell on initializing, so sometimes the
> code below works and sometimes it doesn't. what i need to do is use a similar
> code to delete the unwanted characters on the change event.
>
>
> Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
> Select Case KeyAscii
> Case 8 To 10, 13, 27 'Control characters
> Case 45, 46 'negative and period
> If KeyAscii = 45 Then 'hypen/negative
> If Len(Trim(txtItemFob.Text)) > 1 Then
> Beep
> KeyAscii = 0
> End If
> End If
> Case 48 To 57 'numbers
> Case Else 'Discard anything else
> Beep
> KeyAscii = 0
> End Select
> End Sub
>
> --
> help a friend help you

 
Reply With Quote
 
=?Utf-8?B?ZXJuaWU=?=
Guest
Posts: n/a
 
      22nd May 2007
Hi Akphidelt,

thanks for the reply, i tried using the code below to validate user inputs
but i doesnt seem to work.. so i want to try it using the change event
procedure instead of the keypress.

thank you

--
help a friend help you


"AKphidelt" wrote:

> What is the exact problem? Do you need to delete a cell or are you just
> getting error messages?
>
> "ernie" wrote:
>
> > Hi all,
> >
> > i have my userform pull up info from cell on initializing, so sometimes the
> > code below works and sometimes it doesn't. what i need to do is use a similar
> > code to delete the unwanted characters on the change event.
> >
> >
> > Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
> > Select Case KeyAscii
> > Case 8 To 10, 13, 27 'Control characters
> > Case 45, 46 'negative and period
> > If KeyAscii = 45 Then 'hypen/negative
> > If Len(Trim(txtItemFob.Text)) > 1 Then
> > Beep
> > KeyAscii = 0
> > End If
> > End If
> > Case 48 To 57 'numbers
> > Case Else 'Discard anything else
> > Beep
> > KeyAscii = 0
> > End Select
> > End Sub
> >
> > --
> > help a friend help you

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
apply cell change event to single column - WorksheetChange Event MiataDiablo@gmail.com Microsoft Excel Programming 5 4th May 2008 02:28 AM
Problem with CommandBarComboBox Change Event (Event fires only once) M. Khalid Farooq Microsoft Outlook Interoperability 6 23rd Oct 2006 09:44 AM
Control where change event does not trigger click event? =?Utf-8?B?c3dvcmRmaXNo?= Microsoft Powerpoint 2 17th Jul 2006 06:21 PM
MsgBox in Enter event causes combobox not to run Change event =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Programming 0 6th Mar 2006 02:52 PM
Datagrid cell change event? Where to find event. Roger Microsoft VB .NET 4 29th Mar 2005 09:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:24 PM.