Solved

Excel VBA chart array

Posted on 2010-11-08
2
639 Views
Last Modified: 2012-05-10
Hello Experts,

I need some help to populate two similar chart matrix using VBA. I'm not too sure how approach this. I need to loop within a recordset and build a string to populate a matrix, which depends upon two criteria. This should make more sense if you look at the attached example.

Any help and suggestions are very much appreciated
Employee-Rating.xls
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
krishnakrkc earned 500 total points
ID: 34085786
Hi,

Unmerge the cells on Ratings sheet.

and try this macro.

Kris
Sub kTest()
    Dim k, M(1 To 3, 1 To 3), F(1 To 3, 1 To 3)
    Dim i   As Long, c As Long, r As Long
    
    k = Sheets("Data").UsedRange.Resize(, 3)
    
    For i = 2 To UBound(k, 1)
        Select Case k(i, 3)
            Case Is <= 3
                r = 1: c = k(i, 3)
            Case Is <= 6
                r = 2: c = k(i, 3) - 3
            Case Else
                r = 3: c = k(i, 3) - 6
        End Select
        If k(i, 2) = "Male" Then
            M(r, c) = IIf(Len(M(r, c)), M(r, c) & ", " & k(i, 1), k(i, 1))
        Else
            F(r, c) = IIf(Len(F(r, c)), F(r, c) & ", " & k(i, 1), k(i, 1))
        End If
    Next
    [c3:e5].Value = M
    [h3:j5].Value = F
End Sub

Open in new window

0
 

Author Closing Comment

by:lancegallagher_expertsexchange
ID: 34087615
Thanks very much, this works great!!

Sorry about the slow response, the network went down
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question