Macro Question

G

Guest

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
 
D

Die_Another_Day

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
 
G

Guest

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)
 
O

Otto Moehrbach

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
 
L

L. Howard Kittle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top