Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Delete only the fourth character

Hi,

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

Thanks
Catherine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Delete only the fourth character

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Delete only the fourth character

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete only the fourth character

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" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Delete only the fourth character

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Delete only the fourth character

On Thu, 29 May 2008 08:35:02 -0700, Catherine
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
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Delete only the fourth character

Thanks to everybody for your macro, it's working

Catherine

"Ron Rosenfeld" wrote:

On Thu, 29 May 2008 08:35:02 -0700, Catherine
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete special character Kiannie Excel Discussion (Misc queries) 3 April 2nd 09 11:24 PM
insert "-" as fourth character in number string cursednomore Excel Discussion (Misc queries) 2 February 7th 07 07:33 PM
Delete everything after a certain character [email protected] Excel Programming 4 November 21st 06 09:04 PM
Delete all occurrences of a character Harleygrrl814 New Users to Excel 8 May 11th 05 05:15 PM
Delete everything after a certain character? Chris Excel Programming 2 June 18th 04 09:59 PM


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"