Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Kendosan1
 
Posts: n/a
Default Prepending text to a cell entry

How can I prepend the contstant string "S" to each numeric value entered into
the cells in a column? For example, if a user enters "12345" into a cell, I
want the cell value to be "S12345".
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

using event code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
.Value = "S" & .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kendosan1" wrote in message
...
How can I prepend the contstant string "S" to each numeric value entered

into
the cells in a column? For example, if a user enters "12345" into a cell,

I
want the cell value to be "S12345".



  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default

Custom Format as "S"0.00

Leave off the .00 if you just want whole numbers.

The cell value will still be 12345 but display as S12345

Gord Dibben Excel MVP

On Mon, 27 Dec 2004 10:25:09 -0800, Kendosan1
wrote:

How can I prepend the contstant string "S" to each numeric value entered into
the cells in a column? For example, if a user enters "12345" into a cell, I
want the cell value to be "S12345".


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
Hide text that doesn't fit in the cell Rene Excel Discussion (Misc queries) 1 December 16th 04 04:34 PM
Moving text from one cell to another. estaban botas Excel Worksheet Functions 1 December 15th 04 02:04 PM
how to hyperlink text to a cell steve New Users to Excel 1 December 14th 04 08:21 PM
Formatting a cell as "text" in the number catagory. Ed Excel Worksheet Functions 3 December 7th 04 07:12 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 02:42 AM.

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

About Us

"It's about Microsoft Excel"