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 / April 2007

Tip: Looking for answers? Try searching our database.

Macro to remove last 4 characters from the contents of a cell.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
akkrug - 19 Apr 2007 19:30 GMT
We need to come up with a way to remove the last 4 characters from the
contents of a cell.  I tried a macro, but wasn't sure how to make it go to
the next cell.  For example, I select a cell, press end, backspace 4
positions and then hit enter.  Works great for 1 cell! Is there a way to get
the macro to repeat all the way down the spreadsheet?

As always, Thanks for the help!

Ken
Signature

akkrug

Bernie Deitrick - 19 Apr 2007 19:52 GMT
Ken,

Select the cells and run this macro:

Sub Remove4()
Dim myCell As Range
For Each myCell In Selection
myCell.Value = Left(myCell.Value, Len(myCell.Value) - 4)
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP

> We need to come up with a way to remove the last 4 characters from the
> contents of a cell.  I tried a macro, but wasn't sure how to make it go to
[quoted text clipped - 5 lines]
>
> Ken

Rate this thread:






 
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.