Clear Empty Strings

  • Thread starter Thread starter Tim Tabor
  • Start date Start date
T

Tim Tabor

What is the most efficient way to empty all cells with empty string values?

Thank you.
 
Tom Ogilvy said:
select the cells, then do
Edit=>Clear and select contents or all

Thanks Tom. Couple of things. First, I'm looking for a programmatic
solution. And second, I'm only looking to clear cells whose contents are
empty strings.
 
Dim rng as Range
Dim cell as Range
On Error Resume Next
set rng = Cells.SpecialCells(xlConstants,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
if cell.Value = "" then
cell.ClearContents
end if
Next
End if
set rng = Nothing
On Error Resume Next
set rng = Cells.specialCells(xlformulas,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
if cell.value = "" thenh
cell.ClearContents
end if
Next
End if
 
Back
Top