![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 7
|
I am looking for a VBA code permitting to delete all the spaces in a cell containing text; the spaces can be before and after the text
Thanks |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,382
|
If I understand you correctly, all you want to do is eliminate spaces within text.
This macro does that for column A, by replacing a spacebar character with nothing. Modify for range; if I'm misinterpreting, please repost. Sub DeleteSpaces() Columns("A:A").Replace What:=" ", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByColumns, MatchCase:=False End Sub Tom Urtis |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|