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 = quot;-quot; Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
thanks in advance--
barkiny
------------------------------------------------------------------------
barkiny's Profile: www.excelforum.com/member.php...oamp;userid=20397
View this thread: www.excelforum.com/showthread...hreadid=521016One way:
Use something like:
If IsError(Cells(RowCnt, ChkCol).Value) Then
HTH Otto
quot;barkinyquot; gt; wrote in
message ...
gt;
gt; i want to write a macro when a cell gives error then hide the entire row
gt; (
gt; #VALUE! )
gt;
gt; Sub HideRows()
gt; BeginRow = 1
gt; EndRow = 10
gt; ChkCol = 2
gt;
gt; For RowCnt = BeginRow To EndRow
gt; If Cells(RowCnt, ChkCol).Value = quot;-quot; Then
gt; Cells(RowCnt, ChkCol).EntireRow.Hidden = True
gt; Else
gt; Cells(RowCnt, ChkCol).EntireRow.Hidden = False
gt; End If
gt; Next RowCnt
gt; End Sub
gt;
gt; thanks in advance
gt;
gt;
gt; --
gt; barkiny
gt; ------------------------------------------------------------------------
gt; barkiny's Profile:
gt; www.excelforum.com/member.php...oamp;userid=20397
gt; View this thread: www.excelforum.com/showthread...hreadid=521016
gt;
- Jul 20 Thu 2006 20:08
hide rows when the cell is #VALUE!
close
全站熱搜
留言列表
發表留言