close

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;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()