ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Use custom format to add text to a text entry. (https://www.excelbanter.com/excel-worksheet-functions/116692-use-custom-format-add-text-text-entry.html)

Pierre

Use custom format to add text to a text entry.
 
How might I place a text string in a cell such as "Bell & Howell", and
have the cells contents display: "CUSTOMER: Bell & Howell".

Looks like custom format requires a number. Usine Excel 2003.

TIA for your thoughts.
Pierre


vezerid

Use custom format to add text to a text entry.
 
The following OnChange event procedure in your sheet can do this.

Private Sub Worksheet_Change(ByVal Target As Range)
If __cond__ Then
Application.EnableEvents = False
Target.Value = "CUSTOMER: " & Target.Value
Application.EnableEvents = True
End If
End Sub

Important: __cond__: It will be a condition that tests if this is a
cell in which you want the autochange. Depending on which cells you
want this to hold for the condition will change. If you want this to
hold for the entire sheet just remove the If line and the End If line.

To install: right-click on the sheet tab. Choose View Code... In the
resulting window paste the above code. Example condition:

If not intersect(target,range("A:C") is nothing then

This will only allow the code to fire for cells in columns A:C

Does this help? Write back for exact condition if necessary.

HTH
Kostis Vezerides


Pierre wrote:
How might I place a text string in a cell such as "Bell & Howell", and
have the cells contents display: "CUSTOMER: Bell & Howell".

Looks like custom format requires a number. Usine Excel 2003.

TIA for your thoughts.
Pierre



Pierre

Use custom format to add text to a text entry.
 

vezerid wrote:
The following OnChange event procedure in your sheet can do this.

Private Sub Worksheet_Change(ByVal Target As Range)
If __cond__ Then
Application.EnableEvents = False
Target.Value = "CUSTOMER: " & Target.Value
Application.EnableEvents = True
End If
End Sub

Important: __cond__: It will be a condition that tests if this is a
cell in which you want the autochange. Depending on which cells you
want this to hold for the condition will change. If you want this to
hold for the entire sheet just remove the If line and the End If line.

To install: right-click on the sheet tab. Choose View Code... In the
resulting window paste the above code. Example condition:

If not intersect(target,range("A:C") is nothing then

This will only allow the code to fire for cells in columns A:C

Does this help? Write back for exact condition if necessary.

HTH
Kostis Vezerides




Kostis:
Thank you for the reply, still a little fuzzy. . .

Need it to fire in cell E3

(Other texts in different cells, but I can get there once I load this
one.)
Thanks again.

Pierre


Lori

Use custom format to add text to a text entry.
 
Use the custom number format:
"Customer: "@


Pierre

Use custom format to add text to a text entry.
 

Lori wrote:
Use the custom number format:
"Customer: "@


Got both working fine. Thanks so much.

Pierre



All times are GMT +1. The time now is 06:17 AM.

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