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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top