PC Review


Reply
Thread Tools Rate Thread

Add a prefix to a cell

 
 
Decreenisi
Guest
Posts: n/a
 
      20th Feb 2008
Dear all

I have a large excel (Office 07) spreadsheet, which I enter reject
data everyday. In Column P i have to enter a sticker number such as
S132453. The number always starts with a capital S then 6 numbers. Is
there anyway that when I click into the cell, it automatically enters
an "S" then allows me to type the numbers. I also need to be able to
sort data by sticker number and use a macro to search the spreadsheet
to find specific numbers. Can anyone help

Thanks
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      20th Feb 2008
Try this small Event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set r = Range("P:P")
If Intersect(t, r) Is Nothing Then Exit Sub
If Left(t.Value, 1) = "S" Then Exit Sub
Application.EnableEvents = False
t.Value = "S" & t.Value
Application.EnableEvents = True
End Sub

This will add the "S" for you. If you already have entered an "S" or are
editting old data, it not add an extra "S"
--
Gary''s Student - gsnu200769d


"Decreenisi" wrote:

> Dear all
>
> I have a large excel (Office 07) spreadsheet, which I enter reject
> data everyday. In Column P i have to enter a sticker number such as
> S132453. The number always starts with a capital S then 6 numbers. Is
> there anyway that when I click into the cell, it automatically enters
> an "S" then allows me to type the numbers. I also need to be able to
> sort data by sticker number and use a macro to search the spreadsheet
> to find specific numbers. Can anyone help
>
> Thanks
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prefix in every cell Mike Busch Microsoft Excel Misc 4 7th Jul 2008 09:01 PM
cell prefix Johno313 Microsoft Excel Misc 4 20th Jun 2006 10:35 AM
Cell value prefix NDB Microsoft Excel Discussion 4 1st Feb 2005 03:06 PM
Cell value prefix NDB Microsoft Excel Programming 4 1st Feb 2005 03:06 PM
Cell value prefix NDB Microsoft Excel Worksheet Functions 4 1st Feb 2005 03:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:00 AM.