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


Hello,
does anyone know a macro that could remove the blanks or Space in cell
C11 to C2000 (where there is text) Ex. 20 15 10
Thanks in advance.


--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=473046

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete space in Text


Good evening herve

This cheeky litle macro should do the trick.

Sub RemoveSpaces()
For Each UsrCell In Selection
UsrCell.Value = Application.WorksheetFunction.Substitute(UsrCell.V alue,
" ", "")
Next UsrCell
End Sub

Highlight the range you want it to effect before running it. That way,
it will work on any range you later want to specify, not just
C11:C2000.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=473046

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete space in Text


hello Domincd
thanks for the reply but could you tell me how to do it only for th
cell C11 to C500
without having to do a selection?
Thank

--
herv
-----------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...fo&userid=2731
View this thread: http://www.excelforum.com/showthread.php?threadid=47304

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete space in Text


Hi herve

This will do the trick:

Sub RemoveSpaces()
Range("C11:C500").Select
For Each UsrCell In Selection
UsrCell.Value = Application.WorksheetFunction.Substitute(UsrCell.V alue,
" ", "")
Next UsrCell
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=473046

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Delete space in Text

How about selecting C11:C2000 and then
edit|Replace
what: (spacebar)
with: (leave blank)
replace all

If you need it as a macro, you can record it when you do it manually.

herve wrote:

Hello,
does anyone know a macro that could remove the blanks or Space in cell
C11 to C2000 (where there is text) Ex. 20 15 10
Thanks in advance.

--
herve
------------------------------------------------------------------------
herve's Profile: http://www.excelforum.com/member.php...o&userid=27314
View this thread: http://www.excelforum.com/showthread...hreadid=473046


--

Dave Peterson
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 space after word Niniel Excel Discussion (Misc queries) 14 June 26th 11 04:34 PM
How do I delete a space at the end of an amount or text Maureen Excel Worksheet Functions 5 June 2nd 10 12:06 PM
Delete space Mohamed Excel Discussion (Misc queries) 3 March 8th 05 03:32 PM
Is there a way to use the space bar to delete? Jolene Excel Worksheet Functions 0 November 5th 04 09:00 PM
Is there a way to use the space bar to delete? Jolene Excel Worksheet Functions 1 November 3rd 04 06:03 PM


All times are GMT +1. The time now is 09:24 PM.

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"