PDA

View Full Version : Highlight cells on combobox selection



flatliner
09-05-2007, 09:48 PM
Hello,

I'm totally new to VBA/macros, so hopefully the many experts here can help me out abit.

Is it possible to hightlight certain cells whenever a value from a combobox is selected?

I have attached a sample workbook.

Sheet1 contains some sort of a user permission matrix, on the left side are all the files, on the right signified by R-E-D (read, edit, delete) are the access rights. And we have the 2 combo boxes.

Sheet2 contains sample Groups and Users used to populate the combo boxes in Sheet1.

What I would like to do:

1) When I select a particular group from the Group combo, eg Framework_users, the cells I22:K25 are highlighted in yellow, as illustrated in the matrix. Then selecting Case_Workers will highlight the green cells (and remove yellow cells from the earlier Framework_users). Same goes for Researchers for the blue cells. That's the concept.

2) Assuming 1) is possible, I would like to associate a user with one or more groups. Eg, Alice belongs to groups Framework_users and Researchers. So when I select Alice from the user combo box, the cells associated with her 2 groups will be simultaneously highlighted. Hence we'll get the yellow and blue highlighted cells.

Notes:
- both the Groups and Users combo boxes should work independantly. ie anytime I select a value from either the Group or Users combo box, the cells will be highlighted regardless of what the previous selection was. this could be a simple clear-highlight function of columns IJK maybe?

- preferably there should be a provision for easily assigning users to groups, perhaps by creating new lists in sheet2? rather than assigning users to groups during runtime in the code...

I hope this doesn't sound too complicated to understand and do. Any help much appreciated! :)

flatliner
09-06-2007, 01:32 AM
anyone can :help?

flatliner
09-07-2007, 02:28 AM
no comments at all??

rory
09-07-2007, 02:43 AM
Is it always the same three blocks of cells and no others? Also, is there a set number of groups?