Recording macro

N

Nicola Debiasi

Hi all



I have a problem when recording a macro with excel, the problem is that I am
unable to record relative movement that I do when I selected a cell. I
explain better: I have a list of names and I have to cut them to maximum 10
characters, so I copy one (with relative button on) and paste it in another
place, then I select that cell, edit it and push the right arrow ten times
starting to the extreme left, than I cancel anything else. Excel do not
record my movements, but memorize only the result.

Is there a way to make relative, when recording, even my movement when
editing the text of a cell.



Thank you in advance

Nicola
 
C

Cliff Myers

To my knowledge no. But to help you out with your 10 character thing. If
your text is in cell A1 enter this in B1:
=Left(A1,10)
now B1 will show 10 characters including spaces, whatever is in cell A1.
HTH
 
R

Ron de Bruin

Try this with the list in Column A

Sub Test()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
cell.Value = Left(cell.Value, 10)
Next
End Sub
 
N

Nicola Debiasi

Thank you all guys! (to Cliff in particular for his brilliant and incredibly
simple solution!) Now everithing is very easy!

Nicola
 
R

Ron de Bruin

Hi Nicola

If you choose for the formula you can copy it and do a Paste specal to values
You can delete the A column after that
 
N

Nicola Debiasi

Thank you very much Ron, I have copied the formula on my computer, I am sure
it will be very useful!

thank you again!
Nicola
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top