ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   auto format cell to enter data alphabet in column (https://www.excelbanter.com/excel-worksheet-functions/142305-auto-format-cell-enter-data-alphabet-column.html)

DEE

auto format cell to enter data alphabet in column
 
I have 2 columns on my worksheet. 1st is alphabetical list of projects, 2nd
are the identifying project numbers. when i enter a new project name at the
top of the first column, i want it to enter directly into the correct
alphabetical cell in the column

Gary''s Student

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


All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com