Log in

View Full Version : Recording a macro in Excel


CathyDAquarius
Dec 18, 2007, 04:10 PM
Need a macro that will select the cell one place to the left, edit the content, hit enter, and then move to cell below where started and repeat to end of column (last cell with a value).

Example: 123-456789 is format of cell to be edited - need to remove the hyphen.

Someone had created it for me - and I know they used Concatenate.. but I cannot do it - if I record, it is always going to same cell.

Thank you.

mdosh01
Dec 19, 2007, 07:17 AM
It sounds like you are using the "Record New Macro" function in Excel. Is that correct? Or will you be editing the macro directly in the editor?

Also, the use of concatenate is a different issue from it always going to the same cell.

What version of Excel are you using?

Sorry can't more immediately.

ScottGem
Dec 19, 2007, 07:45 AM
Why do you need a macro? The formula:

=SUBSTITUTE(A1,"-","")

will remove the hyphen from the string. Place that formula in a cell in the same row and change A1 to the address of the cell you want to edit. Then copy the formula down to the end of the column. Finally, Select the column with the formulas and use Copy>Paste Special to paste as Values to the original column.