Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
CindyW
 
Posts: n/a
Default Writing a Macro to add decimal

I need to add a decimal to each number in a column of figures. For examples
7254
6523
8945
12546

I need to put a decimal point where the "thousands" would begin.
e.g:
7254 - 7.254

I want to write a macro that will go to the end of each figure, go back
three spaces and put a decimal there. Is this possible? How do I do it?
HELP!!!!!!!
  #2   Report Post  
Ken Wright
 
Posts: n/a
Default

You don't, you simply put 1000 in an empty cell, copy that cell, select all
your data and do edit / paste special / divide, and then delete the 1000.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"CindyW" wrote in message
...
I need to add a decimal to each number in a column of figures. For
examples
7254
6523
8945
12546

I need to put a decimal point where the "thousands" would begin.
e.g:
7254 - 7.254

I want to write a macro that will go to the end of each figure, go back
three spaces and put a decimal there. Is this possible? How do I do it?
HELP!!!!!!!



  #3   Report Post  
Duke Carey
 
Posts: n/a
Default

Does it have to be a macro?

You can put .001 into an empty cell, copy it, select all the numbers, and use
Edit-Paste Speical-Values-Multiply



If they

"CindyW" wrote:

I need to add a decimal to each number in a column of figures. For examples
7254
6523
8945
12546

I need to put a decimal point where the "thousands" would begin.
e.g:
7254 - 7.254

I want to write a macro that will go to the end of each figure, go back
three spaces and put a decimal there. Is this possible? How do I do it?
HELP!!!!!!!

  #4   Report Post  
dominicb
 
Posts: n/a
Default


Good evening CindyW

Something like this would do it. It doesn't actually count back three
digits from the end, but divides the number by 1000 - the end result
should be the same. Just remember to highlght the ange you want to
affect before running it.

Sub Thousands()
For Each num In Selection
num.Formula = num.Formula / 1000
Next num
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=401295

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
writing macro CN New Users to Excel 2 August 2nd 05 06:16 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 11:56 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"