PC Review


Reply
Thread Tools Rate Thread

Delete only the fourth character

 
 
Catherine
Guest
Posts: n/a
 
      29th May 2008
Hi,

I would like to have a macro that would delete only the fourth character
into the selected cells

Thanks
Catherine
 
Reply With Quote
 
 
 
 
Sam Wilson
Guest
Posts: n/a
 
      29th May 2008
You could just use existing excel formulas and then paste special as values?

put this in cell B2, and it takes the fourth character out of A1

=LEFT(A1,3)&RIGHT(A1,LEN(A1)-4)

Sam

"Catherine" wrote:

> Hi,
>
> I would like to have a macro that would delete only the fourth character
> into the selected cells
>
> Thanks
> Catherine

 
Reply With Quote
 
Catherine
Guest
Posts: n/a
 
      29th May 2008
Thanks Sam,

But I don't want to insert a new column into my workook



"Sam Wilson" wrote:

> You could just use existing excel formulas and then paste special as values?
>
> put this in cell B2, and it takes the fourth character out of A1
>
> =LEFT(A1,3)&RIGHT(A1,LEN(A1)-4)
>
> Sam
>
> "Catherine" wrote:
>
> > Hi,
> >
> > I would like to have a macro that would delete only the fourth character
> > into the selected cells
> >
> > Thanks
> > Catherine

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      29th May 2008
This macro will do what you want...

Sub DeleteFourthCharacter()
Dim Cel As Range
For Each Cel In Selection
Cel.Value = Left(Cel.Value, 3) & Mid(Cel.Value, 5)
Next
End Sub

Rick


"Catherine" <(E-Mail Removed)> wrote in message
news:726BA168-BFDF-4395-8C06-(E-Mail Removed)...
> Thanks Sam,
>
> But I don't want to insert a new column into my workook
>
>
>
> "Sam Wilson" wrote:
>
>> You could just use existing excel formulas and then paste special as
>> values?
>>
>> put this in cell B2, and it takes the fourth character out of A1
>>
>> =LEFT(A1,3)&RIGHT(A1,LEN(A1)-4)
>>
>> Sam
>>
>> "Catherine" wrote:
>>
>> > Hi,
>> >
>> > I would like to have a macro that would delete only the fourth
>> > character
>> > into the selected cells
>> >
>> > Thanks
>> > Catherine


 
Reply With Quote
 
Sam Wilson
Guest
Posts: n/a
 
      30th May 2008
It would be temporary - you could then paste the values of the new column
over the old column before deleting it.

Sam

"Catherine" wrote:

> Thanks Sam,
>
> But I don't want to insert a new column into my workook
>
>
>
> "Sam Wilson" wrote:
>
> > You could just use existing excel formulas and then paste special as values?
> >
> > put this in cell B2, and it takes the fourth character out of A1
> >
> > =LEFT(A1,3)&RIGHT(A1,LEN(A1)-4)
> >
> > Sam
> >
> > "Catherine" wrote:
> >
> > > Hi,
> > >
> > > I would like to have a macro that would delete only the fourth character
> > > into the selected cells
> > >
> > > Thanks
> > > Catherine

 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      30th May 2008
On Thu, 29 May 2008 08:35:02 -0700, Catherine
<(E-Mail Removed)> wrote:

>Hi,
>
>I would like to have a macro that would delete only the fourth character
>into the selected cells
>
>Thanks
>Catherine



======================
Option Explicit
Sub Del4th()
Dim c As Range
For Each c In Selection
c.Value = Application.WorksheetFunction.Replace(c.Value, 4, 1, "")
Next c
End Sub
=========================
--ron
 
Reply With Quote
 
Catherine
Guest
Posts: n/a
 
      4th Jun 2008
Thanks to everybody for your macro, it's working

Catherine

"Ron Rosenfeld" wrote:

> On Thu, 29 May 2008 08:35:02 -0700, Catherine
> <(E-Mail Removed)> wrote:
>
> >Hi,
> >
> >I would like to have a macro that would delete only the fourth character
> >into the selected cells
> >
> >Thanks
> >Catherine

>
>
> ======================
> Option Explicit
> Sub Del4th()
> Dim c As Range
> For Each c In Selection
> c.Value = Application.WorksheetFunction.Replace(c.Value, 4, 1, "")
> Next c
> End Sub
> =========================
> --ron
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert "-" as fourth character in number string =?Utf-8?B?Y3Vyc2Vkbm9tb3Jl?= Microsoft Excel Misc 2 7th Feb 2007 07:33 PM
how do i delete everything after a particular character, after each such character? gilgilgil Microsoft Excel Misc 1 28th Oct 2004 02:53 PM
how do i delete everything after a particular character, after each such character? gilgilgil Microsoft Excel Misc 3 27th Oct 2004 11:31 PM
Delete everything after a certain character? =?Utf-8?B?Q2hyaXM=?= Microsoft Excel Programming 2 18th Jun 2004 09:59 PM
delete last character =?Utf-8?B?VGhlcmVzYQ==?= Microsoft Excel Programming 1 12th Mar 2004 10:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:10 AM.