Automating text in a cell

J

Jock W

Is it possible to apply a formula to a cell so that as soon as it is clicked
into, a prefix for an order number wil appear, leaving the user to input the
actual digits of the order no after the text?
IE. upon clicking the cell, the text "JW/R" would appear and the user could
enter "554" for example

tia
 
S

Scoops

Hi Jock

Paste this code in the sheet (right-click on the sheet's tab and select
View Code):

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 1 Then Target = "JW/R" & Target
Application.EnableEvents = True
End Sub

Amend the column number to that of the column you are using (A=1, B=2
etc).

Regards

Steve
 
D

Duke Carey

One way is to format the cell so that it DISPLAYS the prefix. The cell's
VALUE would not include the JW/R, but it would display and print with the
prefix. If that is satisfactory for your purposes:
1) select the cell or range of cells,
2) go to Format>Cells>Number and select Custom in the left panel
3) in the Type box on the right enter this - including the quotation marks

"JW/R"#

4) Click on OK

Now when somebody types a number in those cells it will display with the
JW/R prefix
 
S

Scoops

Do you know, for the life of me I couln't remember that solution.

Sometimes life is so simple...

Regards

Steve
 
Top