Format Cells to Keystroke

jmarcthro

New Member
Joined
Mar 22, 2002
Messages
2
Is it possible to map keys to Text? Lets say I was in cell A1 and I wanted to be able to key in 1 and the word "Dental" would appear. Any suggestions would be greatly appreciated. Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Sure, very easy really. This code must be placed in the Private Module of the Sheet Object. To do this. right click on the sheet name tab nad select "View Code".


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
Target = Choose(Target, "Dental", "Doctor", "Vet", "Surgeon")
End If
End If
End Sub

This one is geared for numeric entries only in cell A1. If you type 1, then Enter you get "Dental" if 2 "Doctor" etc.

If however you want text as well use the Select case.

Option Explicit
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then

Select Case Target.Value
Case 1
Target = "Dental"
Case 2 To 5
Target = "Doctor"
Case Is > 10
Target = "Fred"
Case "Octopus"
Target = "Squid"

End Select
End If
End Sub


Remove the "Option Compare Text" Statement for case sensitivity.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top