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

I am working with a very large sheet that lists addresses. However the state
code is listed with one upper and one lowercase letter. I want to design a
macro to replace only the last letter with its uppercase equivelant.

eg

Santa Ana Ca
to
Santa Ana CA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Macro Question

Without knowing what range you are trying to deal with I can offer
little help but here is the function you want:

Range("A1").Value = Left(Range("A1").Value,Len(Range("A1").Value -1 _
& WorksheetFunction.Upper(Right(Range("A1").value,1) )

This will do what you asked with range A1 post back if you need more
help

HTH

Die_Another_Day

ALoecher wrote:
I am working with a very large sheet that lists addresses. However the state
code is listed with one upper and one lowercase letter. I want to design a
macro to replace only the last letter with its uppercase equivelant.

eg

Santa Ana Ca
to
Santa Ana CA


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Macro Question

Dim Cell As Range

For Each Cell In Range("A:A")
If Cell < "" Then Cell = Left(Cell, Len(Cell) - 1) & UCase(Right(Cell, 1))
Next Cell

(Adjust your range accordingly)


"ALoecher" wrote:

I am working with a very large sheet that lists addresses. However the state
code is listed with one upper and one lowercase letter. I want to design a
macro to replace only the last letter with its uppercase equivelant.

eg

Santa Ana Ca
to
Santa Ana CA

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Macro Question

If only one of 2 letters is lower case, and you want the lower case letter
made upper case, then just make both letters upper case. HTH Otto
For Each Cell In Range("A:A")
If Cell < "" Then Cell.Value = UCase(Cell.Value)
Next Cell

"ALoecher" wrote in message
...
I am working with a very large sheet that lists addresses. However the
state
code is listed with one upper and one lowercase letter. I want to design a
macro to replace only the last letter with its uppercase equivelant.

eg

Santa Ana Ca
to
Santa Ana CA



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Macro Question

You did ask for a macro and got one solution. Here is a formula solution
FWIW.

=LEFT(A1,LEN(A1)-1)&PROPER(RIGHT(A1,1))

HTH
Regards,
Howard

"ALoecher" wrote in message
...
I am working with a very large sheet that lists addresses. However the
state
code is listed with one upper and one lowercase letter. I want to design a
macro to replace only the last letter with its uppercase equivelant.

eg

Santa Ana Ca
to
Santa Ana CA



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
Macro question Tina Excel Worksheet Functions 2 March 15th 10 03:23 AM
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
Macro Question McCloudK Excel Discussion (Misc queries) 7 September 14th 07 09:41 PM
Macro Question carl Excel Worksheet Functions 0 June 8th 06 03:37 PM
Using a macro question. Adam Kroger Excel Discussion (Misc queries) 6 December 15th 05 09:55 PM


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