Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Finding & Deleting Spaces from Cells

Hi

I have a text file from main frame which i am importing
into excel.

The problem i have is, some of the cells have 256 spaces
in them,i want to delete them by code.. I need to find
these cells which are having 256 spaces in 31 columns
and 'n' number of rows.

Can any one suggest some idea/code please

Thanks inadvance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding & Deleting Spaces from Cells

This code replaces 256 spaces with nothing


Need to do this in 2 steps as trying to replace 256 spaces in one ste
gives an error message... 255 seems to be the maximum



Sub Macro1()
Sheets("SHEET1").Cells.Replace What:=Space(156), Replacement:=""
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Sheets("SHEET1").Cells.Replace What:=Space(100), Replacement:=""
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Su

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Finding & Deleting Spaces from Cells

Thanks very much...

But I want i dont want to replace 256 space but i want to
clear those cells...

how to do if i do not know how many blank spaces are
there

any more ideas please
-----Original Message-----
This code replaces 256 spaces with nothing


Need to do this in 2 steps as trying to replace 256

spaces in one step
gives an error message... 255 seems to be the maximum



Sub Macro1()
Sheets("SHEET1").Cells.Replace What:=Space(156),

Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Sheets("SHEET1").Cells.Replace What:=Space(100),

Replacement:="",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Sub


---
Message posted from http://www.ExcelForum.com/

.

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 spaces in blank cells scubadiver Excel Discussion (Misc queries) 2 February 21st 08 01:09 PM
finding and deleting cells from one excel sheet to another Johnny B Excel Discussion (Misc queries) 5 March 19th 07 11:18 PM
Deleting blank spaces in cells Mr Gow Excel Discussion (Misc queries) 4 May 17th 06 02:06 PM
Finding/deleting duplicates and merging cells Louise Excel Worksheet Functions 1 January 20th 06 10:36 AM
Finding spaces cells Otto Moehrbach[_3_] Excel Programming 4 August 24th 03 04:20 PM


All times are GMT +1. The time now is 05:26 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"