Adding an apostrophe to a column of numbers


D

Denise C.

Hello, I need to add an apostrophe to each cell in a long column of numbers.
I do not want to format them as text or format them as custom - our system
requires the apostrophe at the beginning of the cell. My question is - is
there a way to format one cell with the apostrophe and then copy that
apostrophe down to the other cells?? or can someone write me something that
will allow me to do it quickly? I want to avoid having to go into each cell
and put the apostrophe in! Thank you in advance....
 
Ad

Advertisements

D

Don Guillett

One way. Change 9 to your column
Sub addapostophe()
mc = 9 'column I
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
Cells(i, mc).Value = "'" & Cells(i, mc)
Next i
End Sub
 
F

Fred Smith

I would create an additional column. That way you don't lose the
functionality of the numbers. Use a formula like:
="'"&Text(a1,"0.00")

The first part is double-quote, apostrophe, double-quote.

Regards,
Fred
 
H

Hakyab

I undertand that you want to change the cell contents. Use
= "'" & A1

(first one is double quote, single quote and double quote)
Then copy the result and Paste Value to A1

Hope this helps.
 
D

Denise C.

Thanks everyone! I used Hakyab's & Fred's method and it worked like a
charm!! Don, appreciate the code, may try that out when I have more time....
really appreciate the quick replies!! Have a blessed day!!
Denise
 
F

Fred Smith

Glad to help. Thanks for the feedback.

Fred

Denise C. said:
Thanks everyone! I used Hakyab's & Fred's method and it worked like a
charm!! Don, appreciate the code, may try that out when I have more
time....
really appreciate the quick replies!! Have a blessed day!!
Denise
 
Ad

Advertisements

Joined
Jun 26, 2015
Messages
1
Reaction score
0
One way. Change 9 to your column
Sub addapostophe()
mc = 9 'column I
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
Cells(i, mc).Value = "'" & Cells(i, mc)
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)

Dear Mr. Don Guillett, your solution is perfectly working though if I would like to expand it by selecting multiple columns at the same time, like selecting 9, 10, and 11 and the cells which are not empty to add apostrophe, how would we write this macro again?
Could you please help us out on this?

Thank you very much
 
Last edited by a moderator:

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