need help in adding a ' in front of a column of numbers

N

noreaster

From what I read, a macro does not recored keystrokes. I'm new at this so
bear with me. I have found out that I can make numbers read as text by
adding a ' in front of the number Exa, '3331 '3331-6 '3331-25 so after doing
a sort as text the numbers will be in proper order. I have a column of part
numbers that I need to add a ' in front of the number so it will sort the way
I want. I am using excel 2003.

TIA
 
N

Niek Otten

Another way to make it text is with a formula:

=TEXT(A1,"@")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| From what I read, a macro does not recored keystrokes. I'm new at this so
| bear with me. I have found out that I can make numbers read as text by
| adding a ' in front of the number Exa, '3331 '3331-6 '3331-25 so after doing
| a sort as text the numbers will be in proper order. I have a column of part
| numbers that I need to add a ' in front of the number so it will sort the way
| I want. I am using excel 2003.
|
| TIA
 
G

Gary''s Student

Select the cells you want to change and run this macro:

Sub dontquoteme()
Dim s As String
Dim cell As Range
s = Chr(39)
For Each cell In Selection
cell.Value = s & cell.Value
Next
End Sub
 
N

noreaster

That worked out great, Thank you so much. Most of the code I understand. What
sites do you recommend for learning for newbies and definitions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top