How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Joshua C. Your Own Question

Joshua C.
Joshua C., PC Technician
Category: Microsoft Office
Satisfied Customers: 703
Experience:  Microsoft Certified Desktop Support Technician with over 10 years of experience.
18519760
Type Your Microsoft Office Question Here...
Joshua C. is online now
A new question is answered every 9 seconds

HiI need to have a macro on my spreadsheet copied to another

This answer was rated:

Hi
I need to have a macro on my spreadsheet copied to another page and adjusted.
Macro on page 'equity' must hide lines if value in column P is zero. Only the following lines must be included:
P14 to P21 and P24 to P31
Thank you for using JustAnswer.com my name is XXXXX XXXXX I am going to assist you today.

If you upload the excel file to http://wikisend.com and provide the download link that is generated I can copy and edit the macro for you.
Customer: replied 3 years ago.


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 worksheet
3) Press alt + f11 to open the VBA editing window
4) 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 Next
Dim iCount As Integer

iCount = 0

While iCount < 2

If Range("P14:P21") = "0" And Range("P24:P31") = "0" Then
Range("P14:P21,P24:P31").Select
Selection.EntireRow.Hidden = True
End If
iCount = iCount + 1

Wend

End Sub

Sub unhide_worksheetname()

Cells.Select
Selection.EntireRow.Hidden = False

End Sub

Joshua C. and 3 other Microsoft Office Specialists are ready to help you
I have a also created an example excel worksheet to show the code is working. It can be downloaded at:

http://wikisend.com/download/280622/example.xlsm
Customer: replied 3 years ago.

Excellent-thank you


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 Next
Dim iCount As Integer

 

iCount = 0

 

While iCount < 2

 

If Range("P14:P21,o14:o21") = "0" And Range("P24:P31,o24:o31") = "0" Then
Range("P14:P21,P24:P31,o14:o21,o24:o31").Select
Selection.EntireRow.Hidden = True
End If
iCount = iCount + 1

 

Wend

 

End Sub