View Single Post
  #2   Report Post  
Oliver Ferns via OfficeKB.com
 
Posts: n/a
Default

Why not use validation??? That's what it is there for! There are other ways
but you don't say which 2 letters you want to keep so I will assume it is
the first 2 typed and cell is A1...also, what happens if only 1 character
is entered? Do you want an extra character added? anyways...here goes...

Put this code behind the relevant sheet.....

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then Target.Value = UCase(Left(Target.Value, 2))
End Sub


This will trim the contents of A1 to 2 characters and ensure they are
capitals...

Hth,
Oli

--
Message posted via http://www.officekb.com