View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Formatting a single column

What about changing your If-Then statement to this?

If Target.Column = 3 And Target.Row =6 Then

Rick


"McBarker hotmail.com" <tabarclay@<NOSPAM wrote in message
. ..
I'm trying to format column C, from C6 down in a Worksheet, so that
entries are formatted as soon as they are entered. The data is entered as
"a1" or "b3" (without the quotes), and needs to be displayed as "A-1" or
"B-3" (again, without quotes). The following code converts the text to
uppercase as required, but also can convert the Header in cell C5. Is
there anyway to amend the code so that it doesn't change anything above
C6?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Column = 3 Then
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
Application.EnableEvents = True
On Error GoTo 0
End If

End Sub

I've tried programming this with a For... Next loop, but it looped
endlessly when data is entered, hanging the spreadsheet until giving the 3
fingered salute.

Also, I can't seem to find an effective way to insert the "-" character
into the middle of each entry. Any ideas? Thanks.