View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting blanks and shifting left - cont.

Sounds like you cells are not really blank, but just appear blank.

Dim rng as Range, cell as Range, i as Long
set rng = Selection.Columns(1).Cells

for i = rng(rng.count).row to rng(1).row step -1
set cell = cells(i,rng.column)
if len(trim(cell.Text)) = 0 then
cell.Delete Shift:=xlShiftToLeft
end if
Next

--
Regards,
Tom Ogilvy


"jrb " wrote in message
...
Thanks for the efforts. I have tied them all but nothing is working.
Maybe it has to do with the enire range being selected. If there is a
charator in the column the blanks in that column does not get selected
by means of goto/special/blanks . Is there a way to go through each
cell in a range, check if it is blank if so delete it and shift left?


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