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


Hi!

I use the following code to Cause the first (1) letter of an entry i
column C to be Upper case.
Can I modify it to force the first Two (2) characters to be Upper cas
if in fact they are letters? Or do I need a whole new set of code?

<Start Code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Auto change to uppercase first letter
On Error GoTo ErrHandler
If Target.Count = 1 And Target.Column = 3 Then
Application.EnableEvents = False
sStr = Target.Value
Target.Value = UCase(Left(sStr, 1)) & LCase( _
Mid(sStr, 2))
End If
ErrHandler:
Application.EnableEvents = True
End Sub
<End Code

Thanks in advance for any help or suggestions!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=54560

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Upper Case Woes

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Auto change to uppercase first letter
On Error GoTo ErrHandler
With Target
If .Count = 1 And .Column = 3 Then
Application.EnableEvents = False
.Value = UCase(Left(.Value, 2)) & LCase( _
Mid(.Value, 3, Len(.Value) - 2))
End If
End With
ErrHandler:
Application.EnableEvents = True
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Brian Matlack"
wrote in message
news:Brian.Matlack.28dm8o_1148582402.5499@excelfor um-nospam.com...

Hi!

I use the following code to Cause the first (1) letter of an entry in
column C to be Upper case.
Can I modify it to force the first Two (2) characters to be Upper case
if in fact they are letters? Or do I need a whole new set of code?

<Start Code
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Auto change to uppercase first letter
On Error GoTo ErrHandler
If Target.Count = 1 And Target.Column = 3 Then
Application.EnableEvents = False
sStr = Target.Value
Target.Value = UCase(Left(sStr, 1)) & LCase( _
Mid(sStr, 2))
End If
ErrHandler:
Application.EnableEvents = True
End Sub
<End Code

Thanks in advance for any help or suggestions!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile:

http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=545607



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Upper Case Woes


Thanks Bob!!! Works Great!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=54560

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
convert lower to upper case automatically without using UPPER Sal Excel Discussion (Misc queries) 6 July 26th 09 11:27 AM
Changing upper case characters to upper/lower Richard Zignego Excel Discussion (Misc queries) 1 December 17th 07 10:09 PM
Changing file in all upper case to upper and lower case Sagit Excel Discussion (Misc queries) 15 May 30th 07 06:08 AM
Change the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
How do I convert all upper case excel sheet into upper and lower . DebDay Excel Discussion (Misc queries) 1 March 9th 05 08:31 PM


All times are GMT +1. The time now is 09:24 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"