I have the following VBA code in my sheet:
Sub Clear_Contents()
Range("b12:b45,b51:b78,b84:b92,b97:b105,d12:d45,d51:d78,d84:d92,d97:d105,e12:e45,e51:e78,e84:e92,e97:e105,f12:f45,f51:f78,f84:f92,f97:f105,g12:g45,g51:g78,g84:g92,g97:g105,h12:h45,h51:h78,h84:h92,h97:h105,i12:i45,i51:i78,i84:i92,i97:i105,k12:k45,k51:k78,k84:k92,k97:k105,m12:m45,m51:m78,m84:m92,m97:m105,n12:n45,n51:n78,n84:n92,n97:n105,o1245,o5178,o8492,o97105,p1245,p5178,p8492,p97105,q12:q45,q51:q78,q84:q92,q97:q105,r12:r45,r51:r78,r84:r92,r97:r105,t12:t45,t51:t78,t84:t92,t97:t105").ClearContents
End Sub
I am getting an error code 400, and I believe it is because some of the cells included in this mixture are in hidden rows, Is there anyway to fix this so I can run this and it will still clear all the cells? If the rows are hidden, then the cells do not have to be cleared if this helps at all.
Sub Clear_Contents()
Range("b12:b45,b51:b78,b84:b92,b97:b105,d12:d45,d51:d78,d84:d92,d97:d105,e12:e45,e51:e78,e84:e92,e97:e105,f12:f45,f51:f78,f84:f92,f97:f105,g12:g45,g51:g78,g84:g92,g97:g105,h12:h45,h51:h78,h84:h92,h97:h105,i12:i45,i51:i78,i84:i92,i97:i105,k12:k45,k51:k78,k84:k92,k97:k105,m12:m45,m51:m78,m84:m92,m97:m105,n12:n45,n51:n78,n84:n92,n97:n105,o1245,o5178,o8492,o97105,p1245,p5178,p8492,p97105,q12:q45,q51:q78,q84:q92,q97:q105,r12:r45,r51:r78,r84:r92,r97:r105,t12:t45,t51:t78,t84:t92,t97:t105").ClearContents
End Sub
I am getting an error code 400, and I believe it is because some of the cells included in this mixture are in hidden rows, Is there anyway to fix this so I can run this and it will still clear all the cells? If the rows are hidden, then the cells do not have to be cleared if this helps at all.