View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default selection_change adding text to target

Matt,

Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears.

I've use the change event because you talk about typing in and not just selecting as cell

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 1 Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
Target.Value = "Test - " & Target.Value & " - Test"
Application.EnableEvents = True
End Sub


"Matt Williamson" wrote in message
...
Can I use selection_change to modify the current cell?

e.g I want to type 1234 into any cell in column A and have it change to "Test - 1234 - Test" upon
leaving the cell

TIA

Matt