Solved

number to text macro in EXCEL 2013

Posted on 2014-04-30
13
697 Views
Last Modified: 2014-05-01
Hi Experts
I need some help in properly write a macro in excel, I used to be able to do this in LOTUS123 but I can't figure it out in EXCEL.

I have 4400 lines of nun sequential numbers that I need to be text.  I tried just formatting the column as text but that did not hold the "0" in the last place on the number like I need, so I need to write a macro that will put the apostrophe in front of the number.

when I try to record a macro and the run it, it takes the data (number) from the cell where the macro was written and copies it down with the apostrophe.
So obviously that is no good.

how do I fix this.
0
Comment
Question by:KenBlessing
  • 6
  • 5
  • 2
13 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
Select your data and then run this macro.

sub cvtxt()
for each cel in selection
cel="'" & cel
next cel
end sub
0
 
LVL 35

Expert Comment

by:mvidas
Comment Utility
If you want to do it without a macro, you can use the TEXT function to convert the number to whatever format you want, then copy/paste values to retain the text value.

So if A1 had the value "1234" but you want it to show "001234", you'd do =TEXT(A1,"000000")
Then copy the formula and paste the value over it. It will now contain 001234.

Matt
0
 

Author Comment

by:KenBlessing
Comment Utility
sorry guys neither of these answers work for me.

what I have is :

1.009
1.010
1.011
12.002
12.010

What I whant is to do is put  the " '  " in front of the number

'1.009
'1.010
'1.011
'12.002
'12.010

I hope that helps.

Ken
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
You need to tell us more about "does not work"

Does it give an error?
Does it give wrong results?
Does it do nothing at all?
0
 

Author Comment

by:KenBlessing
Comment Utility
it does nothing at all
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
You have to SELECT the range before running the macro
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:KenBlessing
Comment Utility
I did
0
 

Author Comment

by:KenBlessing
Comment Utility
Can you send a screen shot of the macro in the editor, maybe I put it in wrong.
Thank you
Ken
0
 

Author Comment

by:KenBlessing
Comment Utility
as I said I am really new to macros in excel
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
While I upload a file

Right-click on the sheet tab name
Select View code
From the menu      Insert > Module
Paste this code in the VBA window
Close the VBA window
Select your range
Press Alt-F8
Select the macro name
Click on run
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 250 total points
Comment Utility
0
 
LVL 35

Assisted Solution

by:mvidas
mvidas earned 250 total points
Comment Utility
Ken,

You don't need to have the apostrophe before the value to force the formatting, and you don't need to use macros.

Insert a column next to your data. If your data is in column A, put the following into the (new) B1

=TEXT(A1,"0.000")

That will show the value of cell A1 but with a forced three decimals like you want.

Then copy that formula down as far as the data goes.

Next, select your original cell range and change the format to Text.

Finally, copy your column B with the formatted numbers, go to your original range, and go to Paste -> Paste Special (the little arrow) -> and then the first Paste Values choice.

You can then delete the helper column B.

Your cells will now contain a permanent text version of the number formatted as you want it.

Matt
0
 

Author Closing Comment

by:KenBlessing
Comment Utility
Thank you both Saqib Husain, Syed and Matt both answers worked.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now