Finding & Deleting Spaces from Cells

  • Thread starter Thread starter sudhendra
  • Start date Start date
S

sudhendra

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
 
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
 
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
 
Back
Top