View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Matt Matt is offline
external usenet poster
 
Posts: 516
Default Last 4 digits of SSN

Phillip, thanks. That looks like exactly what I need. One question though?
Is it possible to make it only apply to a change in one particular cell (A1)
instead of any cell on the spreadsheet? Thanks alot.

"Phillip" wrote:



This works for me
Phillip UK London

Put this code in the sheet module
Right click sheet tab and select view code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Thiscell As Range
Static Lastcell As Range

If Target.Cells.Count 1 Then Exit Sub
Set Thiscell = Target
Set Lastcell = Thiscell
If Lastcell Is Nothing Then Exit Sub
Lastcell.Value = VBA.Right(Lastcell.Value, 4)

End Sub