Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default detect upper and lower case letters

i need to tell if the first letter in a text string is capital or lower
case. i have figured out how to do this in the spreadsheet, but now need it
in code. i tried converting my spreadsheet formula to code, but doesn't
work:
If Application.exact(Left(Application.UPPER(Range("A1 ")), 1),
Left(Range("A1"), 1)) = True Then
Range("b1") = "upper case"
Else
Range("b1") = "lower case"
End If
any thoughts? thanks, mike allen


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default detect upper and lower case letters

Hi
try
with Activesheet.Range("A1")
if ucase(left(.value,1))=left(.value,1) then
.offset(0,1).value="Upper case"
else
.offset(0,1).value="Lower case"
end if
end with

--
Regards
Frank Kabel
Frankfurt, Germany


mike allen wrote:
i need to tell if the first letter in a text string is capital or
lower case. i have figured out how to do this in the spreadsheet,
but now need it in code. i tried converting my spreadsheet formula
to code, but doesn't work:
If Application.exact(Left(Application.UPPER(Range("A1 ")), 1),
Left(Range("A1"), 1)) = True Then
Range("b1") = "upper case"
Else
Range("b1") = "lower case"
End If
any thoughts? thanks, mike allen

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default detect upper and lower case letters

If UCase(Left(Range("A1"),1)) = Left(Range("A1"),1) Then
Range("b1") = "upper case"
Else
Range("b1") = "lower case"
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mike allen" wrote in message
...
i need to tell if the first letter in a text string is capital or lower
case. i have figured out how to do this in the spreadsheet, but now need

it
in code. i tried converting my spreadsheet formula to code, but doesn't
work:
If Application.exact(Left(Application.UPPER(Range("A1 ")), 1),
Left(Range("A1"), 1)) = True Then
Range("b1") = "upper case"
Else
Range("b1") = "lower case"
End If
any thoughts? thanks, mike allen




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default detect upper and lower case letters

mike allen,
One way,
Sub LetterCase()
For Each Cell In Selection
If Left(Cell.Value, 1) = _
UCase(Left(Cell.Value, 1)) Then
Cell.Offset(0, 1).Value = "Upper Case"
Else
Cell.Offset(0, 1).Value = "Lower Case"
End If
Next Cell
End Sub

Cecil

"mike allen" wrote in message
...
i need to tell if the first letter in a text string is capital or lower
case. i have figured out how to do this in the spreadsheet, but now need

it
in code. i tried converting my spreadsheet formula to code, but doesn't
work:
If Application.exact(Left(Application.UPPER(Range("A1 ")), 1),
Left(Range("A1"), 1)) = True Then
Range("b1") = "upper case"
Else
Range("b1") = "lower case"
End If
any thoughts? thanks, mike allen




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
Using COUNTIF and VLOOKUP with upper and lower case letters mcilwrk Excel Worksheet Functions 5 May 22nd 07 01:24 AM
How to change lower to upper case letters? Sigi Rindler Excel Discussion (Misc queries) 1 November 25th 06 09:33 AM
How do I create upper/lower case letters in cells? boz130 Excel Discussion (Misc queries) 1 September 14th 05 06:23 PM
Count the occurance of upper or lower case letters Sivsy Excel Worksheet Functions 3 January 13th 05 07:31 PM


All times are GMT +1. The time now is 02:43 PM.

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

About Us

"It's about Microsoft Excel"