Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting characters


Hi,

I would like to be able to delete some characters from some cells.

I want to look for 4 spaces, then delete everything after (and
including) the 4 spaces.



This is probably staring me in the face

Thanks.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting characters


=IF(ISERR(LEFT(A1,FIND(" ",A1)-1)),A1,LEFT(A1,FIND(" ",A1)-1))

considering your test is in A1.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=384473

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default deleting characters

If you are looking for a VBA solution:

Sub ProcStrings()
Dim cell as Range, iloc as Long
for each cell in selection
iloc = instr(1,cell.Value, " ",vbTextCompare)
if iloc 1 then
cell.Value = Left(cell.Value,iloc-1)
else
cell.Value = Trim(cell.Value)
end if
Next
End sub

--
Regards,
Tom Ogilvy



"PLPE" wrote in message
...

Hi,

I would like to be able to delete some characters from some cells.

I want to look for 4 spaces, then delete everything after (and
including) the 4 spaces.



This is probably staring me in the face

Thanks.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile:

http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting characters


brilliant, thanks to both of you for your help.

I'll be going with the VB code.


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting characters


I've tried the VB code, but to no avail.
I now want to look for 2 consecutive spaces.
When they are found, I want to delete them & everything following
after.

I'd prefere to do this using code, rather than a cell formula - I'll
have formulae in the cells at a later stage.

any ideas?


--
PLPE
------------------------------------------------------------------------
PLPE's Profile: http://www.excelforum.com/member.php...o&userid=23856
View this thread: http://www.excelforum.com/showthread...hreadid=384473

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
Deleting LF Characters in cells BillH Excel Worksheet Functions 10 March 19th 08 10:19 PM
Deleting Characters Vinny0128 Excel Discussion (Misc queries) 2 May 7th 07 03:19 AM
Deleting rows with 11+ characters. Sinner Excel Worksheet Functions 4 April 2nd 07 11:50 AM
Deleting rows with 11+ characters. Sinner Excel Discussion (Misc queries) 0 March 29th 07 04:53 PM
Deleting non numeric characters. CyndyG Excel Programming 2 May 4th 05 10:50 PM


All times are GMT +1. The time now is 02:05 AM.

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

About Us

"It's about Microsoft Excel"