Macro for deleting characters

S

Shane

Hi

I am trying to find a way to delete the first 5 characters in a cell, in
about 1700 cells, hence why I want avoid the "manual" process...

I have tried doing this with a Macro, but all the Macro does is replace the
text with what was recorded, it doesnt delete the spaces. (The way I
recorded the Macro was "F2, HOME, del, del, del, del, del, ENTER".

Can anyone suggest where I am going wrong please, or an alternative way of
doing this?

Thanks in advance!

Shane
 
B

Big Brother

See below


Sub ZZZ()
Dim R As Range
For Each R In Range("a1:a1700")
R.Value = Right(R.Value, Len(R.Value) - 5)
Next R
End Sub
 
B

Bob Phillips

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i,"A").Value = Mid(Cells(i,"A").Value,6)
Next i

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
L

Lori

If data is in a column, you could select the column and choose Data >
Text to Columns:
Step 1. Fixed Width
Step 2. Vertical line at 5h character
Step 3. Set first column to Skip.
 
Top