Ok, I have tried to explain what I am trying to do with no success. I am going to post my excel document instead, I believe it will be be easier. If you open this workbook, on the manager input sheet, you will see a button that say something about running the macro. Click it and it will take you to the performance grid sheet and put all of the names on the grid where they are supposed to be.
Now:
As you will see there is a table at the bottome that is not filled out. What I want the macro to do is put all of the people in each colored zone, into the appropriate column in the table below the grid. PLEASE give me some hints here, I have tried multiple things, and they do not work. Of couse I could simply do a copy and paste of each cell, but that would look bad.
The end result will be a performance grid that is locked for editing, but with a distribution table below it that is editable.
Here's a re-worked version. I made the following changes.
1/ Added some lookup tables in a new sheet.
2/ Added 3 formula colums to the "Manager Input" sheet.
3/ Used Named Ranges for lookup tables and for the 'colour' reports.
4/ Rewrote the code as follows.
Let me know what you think.
I will give more detail on how the changes work tomorrow, need sleep now....
VB Code:
Option Explicit
Sub DKBuildReport()
Dim rngName As Range
Dim sName As String
Dim lRowNum As Long
Dim lColNum As Long
Dim sColour As String
Dim rngPerfGrid As Range
Dim rngGridCell As Range
Dim rngColour As Range
'-----------------------------------------------
'Set Initial references and Clear Reports
'-----------------------------------------------
'Set the reference to the Result Grid
Set rngPerfGrid = ThisWorkbook.Worksheets("Performance Grid").Range("B7:K11")
first of all, that is amazing. you really need to set up a tip jar.
I only have one question:
Where are the "rngPALEBLUE", "rngORANGE", etc defined? when I changed them to things like "rngTopPerformer" (I also changed the controls sheet to reflect the change), it started bombing out.
This really is incredible. I could just leave it as the colors, but I want to understand what it is doing and I don't understand how it knows where the color ranges are that it gets the data from, and then which color range in the rngcolour to put it in. Or for that matter, where rngColour is?
Where are the "rngPALEBLUE", "rngORANGE", etc defined?
They are define on the worksheet as named ranges.
Insert-->>Name-->>Define will show you a list of all the names that have been created and what ranges they refer to.
Also have a look in the Excel help file for "Define named cell references or ranges".
Named ranges are really useful in Excel, I use them all the time in formulas, validation, code, etc...
when I changed them to things like "rngTopPerformer" (I also changed the controls sheet to reflect the change), it started bombing out.
Changing the label (top cell) of the range has no effect, you would need to define this as a new range. I would leave the range names as are in both the code and the sheet and just change the labels.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful