Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Macro for deleting characters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shane - 24 Nov 2006 07:51 GMT
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
Big Brother - 24 Nov 2006 08:34 GMT
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

> Hi
>
[quoted text clipped - 10 lines]
>
> Shane
Bob Phillips - 24 Nov 2006 09:03 GMT
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)

> Hi
>
[quoted text clipped - 11 lines]
>
> Shane
Lori - 24 Nov 2006 09:12 GMT
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.

> Hi
>
[quoted text clipped - 11 lines]
>
> Shane
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.