Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
writing macro | New Users to Excel | |||
Help with macro looping and color query function | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
Date macro | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) |