Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dex dex is offline
external usenet poster
 
Posts: 5
Default syntax for to upper case letters?

Hi I have a form coded involving the characters "P" and "Q". But I need
the form to still run without any runtime errors even though the user
enters a lower case p or q. Whats the syntax for the to upper case
letters. Here is my code. Keep in mind that this code works, I just
need to add the to upper statement.

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default syntax for to upper case letters?

try this

If UCase(Left(parttxt.Text, 1)) = "P" And UCase(Left(qtytxt.Text, 1)) = "Q"
Then

--


Gary


"dex" wrote in message
ups.com...
Hi I have a form coded involving the characters "P" and "Q". But I need
the form to still run without any runtime errors even though the user
enters a lower case p or q. Whats the syntax for the to upper case
letters. Here is my code. Keep in mind that this code works, I just
need to add the to upper statement.

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default syntax for to upper case letters?

Include 'Option Compare Text' at the top of the module and VBA will get it
right anyway. Alternatively, use the UCase$() function.







"dex" wrote in message
ups.com...
Hi I have a form coded involving the characters "P" and "Q". But I need
the form to still run without any runtime errors even though the user
enters a lower case p or q. Whats the syntax for the to upper case
letters. Here is my code. Keep in mind that this code works, I just
need to add the to upper statement.

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default syntax for to upper case letters?

Hi dex,
My guess is change the If line to:

If (Left(parttxt.Text, 1) = "P" Or Left(parttxt.Text, 1) = "p") And
(Left(qtytxt.Text, 1) = "Q" Or Left(qtytxt.Text, 1) = "q") Then

But it's only a guess!

Ken Johnson

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
Upper Case Letters to First Letter Upper, Remaining Letters Lower SueW Excel Discussion (Misc queries) 7 February 25th 10 05:32 PM
find the upper case letters within a cell april Excel Discussion (Misc queries) 3 December 2nd 09 05:13 PM
upper case letters FOP38 Excel Worksheet Functions 5 June 2nd 08 08:42 AM
Upper Case Letters FOP38 Excel Discussion (Misc queries) 2 June 2nd 08 04:52 AM
Formatting Upper Case letters Greegan Excel Worksheet Functions 2 January 29th 06 06:15 AM


All times are GMT +1. The time now is 10:21 PM.

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"