![]() |
hide rows when the cell is #VALUE!
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 -- barkiny ------------------------------------------------------------------------ barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397 View this thread: http://www.excelforum.com/showthread...hreadid=521016 |
hide rows when the cell is #VALUE!
One way:
Use something like: If IsError(Cells(RowCnt, ChkCol).Value) Then HTH Otto "barkiny" wrote in message ... 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 -- barkiny ------------------------------------------------------------------------ barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397 View this thread: http://www.excelforum.com/showthread...hreadid=521016 |
All times are GMT +1. The time now is 01:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com