VBA ARRAY Logic

RLGY_LONG

New Member
Joined
Apr 15, 2019
Messages
4
For context I am trying to hide tabs based upon the specified user of my model and I want to make it dynamic such that if new tabs were to come into the model....all I would have to do is say if it were true or false based upon the specified user. I have 5 different users lets call them (WL_business user, YL_business user, WL model developer, YL model developer, Model Developer)

I already have a vba that generates all the tabs in the current worksheet (Below) but I do not know how to link the array (Below) from which I specify the user and whether the tab is suppose to be hidden based upon the true false argument.

Can anyone help with this? I would assume you have to specify the array your pulling from (mind you that will not be static) and the based upon the row the formula has to specify whether the user should have the tab hidden or not. :confused:

Array I am using
INDEXSHEET NAME WLBU YLBU YLMD WLMD MD
1User SpecificationTRUETRUETRUETRUETRUE
2Button_Check FALSEFALSEFALSEFALSETRUE
3Error CheckFALSEFALSEFALSEFALSETRUE
4AdminFALSEFALSETRUETRUETRUE
5Dashboard WLFALSETRUETRUEFALSETRUE
6Dashboard YLTRUEFALSEFALSETRUETRUE
7Dashboard YLLTRUEFALSEFALSETRUETRUE

<colgroup><col><col><col span="5"></colgroup><tbody>
</tbody>

Sub I have
Sub ListSheetNamesInNewWorkbook()


Dim objNewWorksheet As Worksheet


Set objCurrentWorksheet = ThisWorkbook.ActiveSheet

For i = 1 To ThisWorkbook.Sheets.Count
objCurrentWorksheet.Cells(i + 1, 1) = i
objCurrentWorksheet.Cells(i + 1, 2) = ThisWorkbook.Sheets(i).Name
Next i
With objCurrentWorksheet
.Columns("A:B").AutoFit
End With
End Sub

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi & welcome to MrExcel.
How do you determine which group a user is in?
Also what sheet is the list on?
 
Upvote 0
Hi Fluff,

Thanks for the quick response. I determine the group by buttons on the user specification tab.

The sheet the list is on is Button_Check AH.

LMK if you have any other questions.
 
Upvote 0
So will you have one button for each group? & want the code to run when the button is clicked?
 
Upvote 0
For the WLBU group use
Code:
   Dim Cl As Range
   
   With Sheets("Button_Check AH")
      For Each Cl In .Range("B2", .Range("B" & Rows.Count).End(xlUp))
         Sheets(Cl.Value).Visible = Cl.Offset(, [COLOR=#ff0000]1[/COLOR]).Value
      Next Cl
   End With
And change the red 1 to 2 for the next group, then 3 etc
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,370
Messages
6,124,526
Members
449,169
Latest member
mm424

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