hide rows when the cell is #VALUE!

B

barkiny

i want to write a macro when a cell gives error then hide the entire row
(
#VALUE! )

Sub HideRows()
BeginRow = 1
EndRow = 10
ChkCol = 2

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = "-" Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub

thanks in advance
 
O

Otto Moehrbach

One way:
Use something like:
If IsError(Cells(RowCnt, ChkCol).Value) Then
HTH Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top