File ID: 957448
I have reviewed the excel document and the layout of the file is locked (requiring a password).I am unable to add a new worksheet due to the password XXXXX however I can provide you with the steps to do what you are requesting.1) Unlock the document to allow editing.2) Press shift + f11 to add a new worksheet3) Press alt + f11 to open the VBA editing window4) Locate the new sheet that you created in the list on the left of the screen (and double click on it)5) Paste in the following macro PLEASE NOTE: In the spots that say hide_worksheetname and unhide_worksheetname. Put the name of the worksheet where it says worksheetname.Sub hide_worksheetname()On Error Resume NextDim iCount As IntegeriCount = 0While iCount < 2If Range("P14:P21") = "0" And Range("P24:P31") = "0" ThenRange("P14:P21,P24:P31").SelectSelection.EntireRow.Hidden = TrueEnd IfiCount = iCount + 1WendEnd SubSub unhide_worksheetname()Cells.SelectSelection.EntireRow.Hidden = FalseEnd Sub
Just 1 question: how will the macro change if it was applicable to values in more than 1 column (ex column P and column O)?
Sub hide_worksheetname()On Error Resume NextDim iCount As Integer
iCount = 0
While iCount < 2
If Range("P14:P21,o14:o21") = "0" And Range("P24:P31,o24:o31") = "0" ThenRange("P14:P21,P24:P31,o14:o21,o24:o31").SelectSelection.EntireRow.Hidden = TrueEnd IfiCount = iCount + 1