View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
dex dex is offline
external usenet poster
 
Posts: 5
Default How to trim a character from a cell ?

Hi Rowan do you know the syntax to use the to upper for characters in
VBA. For example if the user enters a capitol P or a lower case p the
form will still run without any runtime errors. Here is my code I have
for my form. Everything works fine, I just want to know how to write
the code so that if the user enters a lowercase character it would
still work.

thanks,

r = Application.CountA(Range("A:A"))

If Left(parttxt.Text, 1) = "P" And Left(qtytxt.Text, 1) = "Q" Then
Range("A1").Offset(r + 1, 0) = Me.parttxt.Value
Range("B1").Offset(r + 1, 0) = Me.qtytxt.Value
Me.parttxt.Value = ""
Me.qtytxt.Value = ""
Me.parttxt.SetFocus
Else: MsgBox "Wrong Part or Qty Scanned", vbCritical
Me.parttxt.Value = ""
Me.qtytxt.Value = ""
Me.parttxt.SetFocus

End If
End Sub