Link to home
Start Free TrialLog in
Avatar of Kelvin Sparks
Kelvin SparksFlag for New Zealand

asked on

Excel Macro Challenge

Hi experts,

I'm a little out of my comfort zone here, being an Access developer who now has an Excel VBA challenge.

I have a workbook with many worksheets. On one of the configuration sheets I have a series (perhaps could be a number of named ranges) with yes/no combos. Three columns to the left of each is a unique code no.

As each yes/no is set, it needs to gather the code number, then go to a selected number of other worksheets and find that code in a predetermined colum in each. The worksheets and columns can be stored in a table in another worksheet. Once found (and there will always be a match) the row that the code is in is hidden if the yes/no is no, and unhidden if yes.

To further complicate things, whenever the workbook is opened, it needs to check each and evry one of the yes/no values and ensure that the the appropraite rows are hidden or not.

I'm quite happy to battle through the VBA if I can get a few pointers and equally happy to break this into a number of questions if there's too much here.


Kelvin

Kelvin
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Kelvin - can you post a sample workbook?
Avatar of Kelvin Sparks

ASKER

I'll make up a sample and upload
The sample xlsx file has a number of sheets. If you look at the sheet select product - two rows have yes and one no. Looking at worksheet Admin, it tells us to only use workbooks Wholesale and Retail.

Going back to Select product, there is a yes in the row for product 100, I want it to check the worksheetslisted in Admin and look in the column indicated for that worksheet for the code 100. As this is yes, that row containing the code 100 in each of the Retail and wholesale workbooks should be unhidden. For product code 101, there is a no, so the rows for the 101 code in thosew two sheets are to be hidden. Worksheet Product Details is not listed in Admin and so is to be ignored for this exercise.


Kelvin
Sample.xlsx
For worksheet Wholesale I take it should be col B to check rather than C? Does the (un)hiding of rows apply only to those codes in the first sheet - i.e. if other rows are hidden they should be left as they are?
ASKER CERTIFIED SOLUTION
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, I'm away today, but will try this over the weekend - looking very very promising!


Kelvin
Thanks for the very efficient code. I'm having some fun and games with it running against locked or protected sheets, but am working through this.
Hi,

The link below is a followup question for this answer - more points on offer!

Hope you can help

https://www.experts-exchange.com/questions/27672336/Excel-Macro-Challenge-Pt-2.html