Cell Editing Macro


Posted by RJ Moreno on October 19, 2001 6:46 AM

I am trying to write a cell editing macro:
i.e.
I've copied a range of cells that contain values such as 11111.64-. Excel obviously dos not recognize these cells as numbers. As a Lotus 123 user, the way to edit these cells would be to write the a macro:
{edit}{backspace}{home}-~{down}.
This macro would edit the cell by removing the negative operand at the end of the cell, then moving to the begining of the cell and inserting the negative operand. The macro then moves down to the next cell.

I have attempted to duplicate these keystrokes using the"record amcro" feature in excel, and although it works when I am recording it. If I save the macro and try to use it again on other simailar data that I've copied into the spreadshhet, it goes back to the original cell and enters the value from the original keystrokes and then always returns to the cell directly below the that cell.
Anyone know the keystrokes or visual basic commands that I can use to duplicate this Lotus macro in excel?

Thanks for your help.

Posted by Juan Pablo on October 19, 2001 6:50 AM

If you can use a formula try

=IF(RIGHT(A1)="-",LEFT(A1,LEN(A1)-1)*-1,A1)

Change A1 to the range your number is.
Juan Pablo



Posted by Roger Hunt on October 19, 2001 7:02 AM

http://geocities.com/aaronblood/pages/vba.html (#22 - Dash Masher)