sahmed8251
New Member
- Joined
- Jul 6, 2021
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hello everyone.
I need your help!
Firstly. ADMIN. Please update the title thread accordingly as I am not sure it best suits my actual question.
I am a novice at this. my knowledge of VBA is: I basically copy and paste codes I find on the internet, try it out and if it works, modify to suit!
my code currently is as follows
What the code does it unprotects the workbook, unhides the sheets, goes back to first sheet, and then protects the workbook again.
I also have another set of VBA that does the opposite (hides the same worksheets).
Is there a way to combine the VBA so it checks whether it is hidden or not first and then either hide or unhide accordingly. Like an if formula style on an excel cell.
Hope this all made sense. My first time on here so please bare with me.
I need your help!
Firstly. ADMIN. Please update the title thread accordingly as I am not sure it best suits my actual question.
I am a novice at this. my knowledge of VBA is: I basically copy and paste codes I find on the internet, try it out and if it works, modify to suit!
my code currently is as follows
Sub SHOW01()
'unprotect workbook to allow VBA to work
ActiveWorkbook.Unprotect (Easy123$)
'declare variables
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("01 MANF")
Set ws2 = Worksheets("01 COMMS")
ws1.Visible = True
ws2.Visible = True
'go back to gen assy sheet
'reprotect workbook
Worksheets("GENERAL ASSY LIST").Activate
ActiveWorkbook.Protect (Easy123$), True, False
'select a certain cell within the sheet selected above
'Range("A1").Select
End Sub
What the code does it unprotects the workbook, unhides the sheets, goes back to first sheet, and then protects the workbook again.
I also have another set of VBA that does the opposite (hides the same worksheets).
Is there a way to combine the VBA so it checks whether it is hidden or not first and then either hide or unhide accordingly. Like an if formula style on an excel cell.
Hope this all made sense. My first time on here so please bare with me.