[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/07/2009 at 02:32AM PDT, ID: 24712179
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Conditional Formatting when 'this' cell's ref appears in a list

Asked by hawkeye_zzz in Microsoft Excel Spreadsheet Software

Tags: Conditional formatting reference

The code below (from Question ID:24709907) drops dependents from a highlighted list into a new sheet. It drops the Original cell ref in Column A and the Dependent cell ref in Column B (cell refs include sheet name).

The question now is, can additional lines be added, or a follow on macro, which conditionally formats the highlighted cells (on which the original macro was just run) as follows:
1) if the cell in question does not appear in column A of the new sheet at all, no formatting
2) if the cell in question appears in column A of the new sheet once (i.e. it has one dependent exactly), cell pattern/background = acqua/light blue
3) if the cell in question appears in column A of the new sheet more than once (i.e. it has more than one dependent), cell pattern/background = Red

One additional complication: I'm only interested in cell dependents on other sheets, so this could be dealt with by:
a) changing the original macro so it doesn't include 'own-sheet' dependents
b) deleting own sheet dependents from the list after the macro has run
c) defining only 'different-sheet' dependents on the conditional formatting
d) anything else clever
...(b) would be best so it can be isolated and deleted from the macro if I need them back in, so if doing it this way, pls comment in the code
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
Sub ListDependents()
   Dim wks As Worksheet
   Dim rngFormulas As Range, rngCell As Range
   Dim objDict As Object
   Dim varDeps As Variant, varItem As Variant
   Dim lngRow As Long, x As Long, y As Long
   Dim wksOut As Worksheet
   Application.ScreenUpdating = False
   Set rngFormulas = Selection
   ' this Dictionary will hold the addresses
   Set objDict = CreateObject("Scripting.Dictionary")
   
   If Not rngFormulas Is Nothing Then
      For Each rngCell In rngFormulas
         ListCellDependents rngCell, objDict
      Next rngCell
      Set rngFormulas = Nothing
   End If
   Set wksOut = Worksheets.Add
   wksOut.Range("A1:B1").Value = Array("Original Cell", "Dependents")
   lngRow = 2
   For Each varItem In objDict.Keys
      varDeps = Split(objDict.Item(varItem), "|")
      For y = LBound(varDeps) To UBound(varDeps)
         wksOut.Cells(lngRow, "A").Value = varItem
         wksOut.Cells(lngRow, "B").Value = varDeps(y)
         lngRow = lngRow + 1
      Next y
   Next varItem
   Application.ScreenUpdating = True
   
End Sub
Sub ListCellDependents(rngCheck As Range, dict As Object)
   Dim lngSheetCounter As Long, lngRefCounter As Long
   Dim strKey As String, strAddy As String
   strKey = "'" & rngCheck.Parent.Name & "'!" & rngCheck.address(0, 0)
   lngSheetCounter = 1
   On Error Resume Next
   With rngCheck
      .ShowDependents False
      Do
         lngRefCounter = 1
         Do
            .NavigateArrow False, lngSheetCounter, lngRefCounter
            strAddy = "'" & Selection.Parent.Name & "'!" & Selection.address(0, 0)
            If Err.Number = 0 Then
               If strAddy = strKey Then
                  rngCheck.ShowDependents True
                  Exit Sub
               Else
                  If dict.Exists(strKey) Then
                     dict(strKey) = dict(strKey) & "|" & strAddy
                  Else
                     dict(strKey) = strAddy
                  End If
               End If
               lngRefCounter = lngRefCounter + 1
            Else
               Err.Clear
               Exit Do
            End If
         Loop
         lngSheetCounter = lngSheetCounter + 1
      Loop
   End With
End Sub
[+][-]09/07/09 03:18 AM, ID: 25273969

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: Conditional formatting reference
Sign Up Now!
Solution Provided By: rorya
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09/07/09 04:44 AM, ID: 25274344

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/07/09 04:49 AM, ID: 25274362

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625