Greetings to all,
So this is my first time doing coding in excel and I've searched the forums and scrapped this together.
What I'm trying to do here is in H5, if it is set to Small then I want to hide sheets 8. 6509 Core1 - Med or Lg Site, 9. 6509 Core2 - Med or Lg Site and 10. Uplink Map - Med or Lg if it's set to anything else then hide the tabs 8. 3750 Core1 - Small Site, 9. 3750 Core2 - Small Site, and 10. Uplink Map - Small. I have this set on Sheet1 (1. Cover Sheet). Here's the code...
So what is happening is it's getting all confused and mixing up. Hiding some but not hiding others. Also is there a way to reset the tabs so they are all visible?Sub Number_Cores() If Range("H5").Value = "Small" Then Sheets("8. 6509 Core1 - Med or Lg Site").Visible = False Sheets("9. 6509 Core2 - Med or Lg Site").Visible = False Sheets("10. Uplink Map - Med or Lg").Visible = False Else Sheets("8. 3750 Core1 - Small Site").Visible = False Sheets("9. 3750 Core2 - Small Site").Visible = False Sheets("10. Uplink Map - Small").Visible = False End If End Sub
Thanks in advance...
Hi tearl,
When referring to multiple sheets within one macro, I'd recommend always specifying the sheet you're referring to, e.g.
If that doesn't fix the problem, let us know..Sub Number_Cores() If Sheets("1. Cover Sheet").Range("H5").Value = "Small" Then Sheets("8. 6509 Core1 - Med or Lg Site").Visible = False Sheets("9. 6509 Core2 - Med or Lg Site").Visible = False Sheets("10. Uplink Map - Med or Lg").Visible = False Else Sheets("8. 3750 Core1 - Small Site").Visible = False Sheets("9. 3750 Core2 - Small Site").Visible = False Sheets("10. Uplink Map - Small").Visible = False End If End Sub
To answer your second question (make all sheets visible again), you could use a macro such as:
Sub showAll() Dim i as Long For i = 1 to Thisworkbook.Worksheets.Count Sheets(i).Visible = True Next i End Sub
How about posting a copy of your workbook with any private data removed. All we really need to see is the sheets and cell H5 of the "1. Cover Sheet" (and if H5 is linked to a range, don't delete that range of course).
First thing I'd check, though, is that your worksheet tabs are named EXACTLY the same as you have it in the macro.. same spelling, capitalization, spacing, punctuation. Any difference and it will not work.
Hey Guys, Sorry this took so long... I had to quit looking at this as my eyes were starting to bleed...
Here is a scrubbed copy of my doc. It's kind of massive so I zip'd it up.
I'm trying to do a couple things here...
1. Based on the value of H5, I'm trying to hide either tabs 8. 3750 Core1 - Small Site, 9. 3750 Core2 - Small Site and 10. Uplink Map - Small or 8. 6509 Core1 - Med or Lg Site, 9. 6509 Core2 - Med or Lg Site and 10. Uplink Map - Med or Lg.
2. Based on the value of F5, I'm trying to hide columns J, O, P, Q, R and V in tab 7. Access IP Addrs - MNS. If its 2 then they are visible. If its 1 then they are EntireColumn.visable = False. Messing with this yesterday, I could get the auto-calculation to make them disappear, but not re-appear.
Thanks for any help you can provide.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks