Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
NDB NDB is offline
external usenet poster
 
Posts: 3
Default Cell value prefix

Hi,

I'm looking for a way to implement this ...

When a user selects cell A1 and enters a value (text), I would like the
displayed text to display a prefix also.

How can this be achieved?

eg. If user types in cell A1 the text value "Paul", when the enter key is
pressed, I would like the cell value displayed to be "England - Paul".
Likewise for example typing in "David" would give "England - David".

Cand this be done in using VBA or cell formatting?

TIA.

--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)



  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27,285
Default Cell value prefix

For VBA (you posted this in programming)
? ActiveCell.NumberFormat
"England - "@

- Manually
From the Menu
Format, cells, Number format Tab, choose custom

"England - "@




--
Regards
Tom Ogilvy


"NDB" wrote in message
...
Hi,

I'm looking for a way to implement this ...

When a user selects cell A1 and enters a value (text), I would like the
displayed text to display a prefix also.

How can this be achieved?

eg. If user types in cell A1 the text value "Paul", when the enter key is
pressed, I would like the cell value displayed to be "England - Paul".
Likewise for example typing in "David" would give "England - David".

Cand this be done in using VBA or cell formatting?

TIA.

--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)





  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
NDB NDB is offline
external usenet poster
 
Posts: 3
Default Cell value prefix

"Tom Ogilvy" wrote in message
...
For VBA (you posted this in programming)
? ActiveCell.NumberFormat
"England - "@

- Manually
From the Menu
Format, cells, Number format Tab, choose custom

"England - "@




--
Regards
Tom Ogilvy


"NDB" wrote in message
...
Hi,

I'm looking for a way to implement this ...

When a user selects cell A1 and enters a value (text), I would like the
displayed text to display a prefix also.

How can this be achieved?

eg. If user types in cell A1 the text value "Paul", when the enter key

is
pressed, I would like the cell value displayed to be "England - Paul".
Likewise for example typing in "David" would give "England - David".

Cand this be done in using VBA or cell formatting?

TIA.

--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)






Excellent. Thanks Tom.


--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)


  #4   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Cell value prefix

NDB,

You could use the custom format of

;;;"England - "@

But that would only affect how the value is displayed. But you could use an
event to change the actual value - this example (below) will work on column
A. Copy the code, right click on the cell tab and select "View Code" then
paste in the window that appears:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
If Left(Target.Value, 10) < "England - " Then
Target.Value = "England - " & Target.Value
End If
Application.EnableEvents = True
End If
End Sub

HTH,
Bernie
MS Excel MVP


"NDB" wrote in message
...
Hi,

I'm looking for a way to implement this ...

When a user selects cell A1 and enters a value (text), I would like the
displayed text to display a prefix also.

How can this be achieved?

eg. If user types in cell A1 the text value "Paul", when the enter key is
pressed, I would like the cell value displayed to be "England - Paul".
Likewise for example typing in "David" would give "England - David".

Cand this be done in using VBA or cell formatting?

TIA.

--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)





  #5   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
NDB NDB is offline
external usenet poster
 
Posts: 3
Default Cell value prefix

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
NDB,

You could use the custom format of

;;;"England - "@

But that would only affect how the value is displayed. But you could use

an
event to change the actual value - this example (below) will work on

column
A. Copy the code, right click on the cell tab and select "View Code" then
paste in the window that appears:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Application.EnableEvents = False
If Left(Target.Value, 10) < "England - " Then
Target.Value = "England - " & Target.Value
End If
Application.EnableEvents = True
End If
End Sub

HTH,
Bernie
MS Excel MVP


"NDB" wrote in message
...
Hi,

I'm looking for a way to implement this ...

When a user selects cell A1 and enters a value (text), I would like the
displayed text to display a prefix also.

How can this be achieved?

eg. If user types in cell A1 the text value "Paul", when the enter key

is
pressed, I would like the cell value displayed to be "England - Paul".
Likewise for example typing in "David" would give "England - David".

Cand this be done in using VBA or cell formatting?

TIA.

--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)






And thanks to you too Bernie.


--
NDB.

(Remove [nospam] from e-mail address when corresponding by e-mail)




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prefix in every cell Mike Busch[_2_] Excel Discussion (Misc queries) 4 July 7th 08 09:01 PM
Increment cell prefix Brettjg Excel Discussion (Misc queries) 2 April 27th 07 09:08 AM
cell prefix Johno313 Excel Discussion (Misc queries) 4 June 20th 06 10:35 AM
Country Prefix in same cell Ely Excel Discussion (Misc queries) 3 December 30th 05 12:09 AM
Cell value prefix NDB Excel Worksheet Functions 4 February 1st 05 03:06 PM


All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"