excel - If #REF! then hide certain rows -


i have created 2 sheets, sheet no. 1 shows data nicely , other imports data. therefore sheet no. 1 gets data sheet no. 2. there no data in sheet no 2. gives cells in sheet 1 "#ref!". when happens need hide rows in sheet 1.

so imagine this

sub hidecharts()  beginrow = 132 endrow = 138 chkcol = 8  rowcnt = beginrow endrow     if cells(rowcnt, chkcol).value = 0         cells(rowcnt, chkcol).entirerow.hidden = true     end if next rowcnt          rowcnt = beginrow endrow             if cells(rowcnt, chkcol).value <> 0                 cells(rowcnt, chkcol).entirerow.hidden = false             end if         next rowcnt end sub  

however works if data 0 , got no clue on how catch #ref! hides rows contains 0 value, need catch rows 130 140

so thought, else turn stack overflow?

like this:

change if cells(rowcnt, chkcol).value = 0 then if cells(rowcnt, chkcol).value = 0 or iserror(cells(rowcnt, chkcol).value)

sub hidecharts()  beginrow = 132 endrow = 138 chkcol = 8  rowcnt = beginrow endrow     if cells(rowcnt, chkcol).value = 0 or iserror(cells(rowcnt, chkcol).value)         cells(rowcnt, chkcol).entirerow.hidden = true     else           'you don't need if rows visible @ start           cells(rowcnt, chkcol).entirerow.hidden = false     end if end sub  

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -