Replace Error with Empty Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A B
01.01.1976 27760
#VALUE!
01.01.1978 28491

Column A has date in txt and blank but not empty cells. Column B has Formula
A1*1 filled down by macro. Blank cells in column A give error. How I could
make a macro that makes column C wich is like column B, but has replaced
error cells with empty cells.
 
Hi raparipa

Look in the VBA help for Specialcells

On Error Resume Next
Columns("C").SpecialCells(xlCellTypeFormulas, xlErrors).Value = ""
On Error GoTo 0
 
Sub ABC()
Dim rng as Range, cell as Range
set rng = Range("B1",Cells(rows.count,2).End(xlup))
for each cell in rng
if not iserror(cell) then
cell.offset(0,1).Value = cell.Value
end if
Next
End Sub
 
Back
Top