excel vba code checks series of 4 named ranges for unhidden range then unhides 1,can repeat 4x

jtatt

New Member
Joined
May 1, 2019
Messages
32
hello
I have four named ranges tcd1, tcd2, tcd3 and tcd4 which are all hidden when user opens sheet
What I would appreciate is vba code (if it's possible) when the user clicks macro button
code checks tcd1,2,3 and 4 for their hidden/unhidden status and unhides one of the hidden named ranges

then if the user runs the code a 2nd time code checks tcd1,2,3 and 4 for hidden range and unhides one of the hidden ranges

user can then repeat running the macro a 3rd and 4th time to unhide one more range each time

if the user clicks the macro button a 5th time a message box or error shows that there are no further reports

tcd1,2,3 and 4 appear the same, order they are unhidden is not important

My apologies that I have not experimented with code
Thank you for reading my request for help
Julie
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
What version of XL do you have?
In more recent versions, tcd1/tcd2/tcd3/tcd4 cannot be used as names because they are cell references.
I suggest you change to some other names (for example, like in the macro below.

How are the ranges hidden? By rows or by columns?
Assuming by rows :
Code:
Sub v()
Dim r%, x%
For r = 1 To 4
    If Range("tcd_" & r).EntireRow.Hidden = True Then
        Range("tcd_" & r).EntireRow.Hidden = False
        x = 1
        Exit For
    End If
Next
If x <> 1 Then MsgBox "No further reports"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,375
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top