ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace Error with Empty Cell (https://www.excelbanter.com/excel-programming/375876-replace-error-empty-cell.html)

raparipa

Replace Error with Empty Cell
 
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.

Ron de Bruin

Replace Error with Empty Cell
 
Hi raparipa

Look in the VBA help for Specialcells

On Error Resume Next
Columns("C").SpecialCells(xlCellTypeFormulas, xlErrors).Value = ""
On Error GoTo 0



--
Regards Ron de Bruin
http://www.rondebruin.nl



"raparipa" wrote in message ...
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.




Tom Ogilvy

Replace Error with Empty Cell
 
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

--
Regards,
Tom Ogilvy


"raparipa" wrote:

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.



All times are GMT +1. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com