View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default auto format cell to enter data alphabet in column

Assume columns E & F with E1 and F1 empty and ready for data entry. The
following routine will run as soon as you have entered data in both E1 and
F1. It will sort the data and leave a new empy area in E1 and F1:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("E1:F1"), Target) Is Nothing Then
Exit Sub
End If
If IsEmpty(Range("E1")) Or IsEmpty(Range("F1")) Then
Exit Sub
End If
Application.EnableEvents = False
Range("E:F").Sort Key1:=Range("E1")
Range("E1:F1").Insert Shift:=xlDown
Application.EnableEvents = True
End Sub


This is worksheet code - don't put in a standard module.
--
Gary''s Student - gsnu200720