formatting a cell to display a word when i enter a reference lette

M

megan62685

I have a very long list of names. I want to create a column that will allow
me to seperate the names into categories: restaurant, store, brand. I want to
format the column to let me enter a letter: r, s , or b, and then the cell
will display: restaurant, store or brand
 
G

Gary''s Student

An example using column A:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:A")) Is Nothing Then
Exit Sub
End If
Set r = Target
Application.EnableEvents = False
If r.Value = "r" Then r.Value = "restaurant"
If r.Value = "s" Then r.Value = "store"
If r.Value = "b" Then r.Value = "brand"
Application.EnableEvents = True
End Sub

This is worksheet event code and must be entered in the worksheet code area,
not a standard module.
 
D

Dave Peterson

Another couple options.

Create 3 new autocorrect options (tools|Autocorrect options)

r$$ replaced with restaurant
s$$ with store
b$$ with brand

Any unique strings (easy to type) would work.

Be aware that these autocorrect rules are shared in the Office suite. You may
want to get rid of them when you're done.



Or turn on Autocomplete.
Tools|Options|edit tab|check Enable AutoComplete for Cell values

As long as your data is close together (in a single column), it may work nicely
for you.

I'd turn this off as soon as I was done--I find it irritating.
 
Top