Quit a tricky question:
Why does following code end up with an error 91 the second time the find command is executed ?
Note:The data is sorted whereas all "N/A" are at the very beginning and "0" is a the end of the list.
nRow = Columns(1).Find(What:="N/A", After:=Cells(nLastDataRow, 1), LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range(Rows(1), Rows(nRow)).Hidden = True
nRow = Columns(1).Find(What:="0", After:=Cells(1, 1), LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlNext).Row
Range(Rows(nRow), Rows(nLastDataRow)).Hidden = True
Does anybody have an idea ?
cheers,
Goppi
Why does following code end up with an error 91 the second time the find command is executed ?
Note:The data is sorted whereas all "N/A" are at the very beginning and "0" is a the end of the list.
nRow = Columns(1).Find(What:="N/A", After:=Cells(nLastDataRow, 1), LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range(Rows(1), Rows(nRow)).Hidden = True
nRow = Columns(1).Find(What:="0", After:=Cells(1, 1), LookIn:=xlValues, SearchOrder:=xlByRows, SearchDirection:=xlNext).Row
Range(Rows(nRow), Rows(nLastDataRow)).Hidden = True
Does anybody have an idea ?
cheers,
Goppi