Solved

Dashboard Details via "Link"

Posted on 2011-03-01
9
332 Views
Last Modified: 2012-05-11
I'm working on a Dashboard that provides a Summary of all the important information that our management needs to run our business.  I had the idea of a section last night and wanted to get some feedback as to the possibility of it.  Basically, I'll be linking to a query in an Access Database that contains all of the expense records (from Quickbooks via QODBC) for each of our departments (Sales, Marketing, etc.)  It will also have a field/column for the month.  

What I have now is a table that has departments for rows, and months for columns, that totals the records for each combination (Sales-Feb, Marketing-Jan, etc.)  

I'm wondering if it's possible to write a VBA script that, when you click on any of those combinations:
1. opens a new workbook
2. writes all of the records for that "clicked" combination

Is that possible and/if so, extremely difficult?
0
Comment
Question by:BBlu
[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
  • 5
  • 4
9 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35010451
Yes it s possible. Could you upload a sample workbook?

Sid
0
 

Author Comment

by:BBlu
ID: 35010580
Coming up.
0
 

Author Comment

by:BBlu
ID: 35011151
This shows what I'm talking about.  Cols. A-C represent the data that I will link to/import into Excel.  The summary table will sum up the departments...and when you click on one (yellow one; Marketing/November), I want it to create a new workbook with the details behind the number.

 Dashboard-Question.xls
0
Industry Leaders: 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!

 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 35012295
Like this? Sample File Attached.

When you click inside the table and click on the command button then the data will be exported to a file and saved to location "C:\MyFile.xls"

Sid

Code Used

Private Sub CommandButton1_Click()
    Dim i As Long, lastRow As Long
    Dim rRow As Long, cCol As Long
    Dim mMonth As Long
    Dim rng As Range
    Dim wb1 As Workbook
    Dim Dept As String
    
    '~~> Change the range to the relevant range here
    If Intersect(Selection, Range("F7:H11")) Is Nothing Then
        MsgBox "Please select the cell in the correct range"
        Exit Sub
    End If
    
    Application.ScreenUpdating = False
    
    lastRow = Range("A" & Rows.Count).End(xlUp).Row
    
    rRow = Selection.Row
    cCol = Selection.Column
    mMonth = Month(Cells(6, cCol).Value)
    Dept = Cells(rRow, 5).Value
    
    Set rng = Range("A1:C1")
    For i = 2 To lastRow
        If Month(Range("A" & i).Value) = mMonth And Range("C" & i).Value = Dept Then
           Set rng = Union(rng, Range("A" & i & ":C" & i))
        End If
    Next i
    
    Range(rng.Address).Copy
    
    Set wb1 = Workbooks.Add
    
    wb1.Sheets(1).Activate
    ActiveSheet.Paste
    
    '~~> Change the file Name Here
    wb1.SaveAs "C:\MyFile.xls"
    wb1.Close
    
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

Open in new window

Dashboard-Question.xls
0
 

Author Comment

by:BBlu
ID: 35012639
Wow!  That is awesome.  It gave me an error initially, but when I clicked "End", it still opened the file.  I changed the path, and it saved it fine.  But it then didn't open the spreadsheet automatically.  How can I add that function (back)?
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35012651
If you want to see the spreadsheet then delete the line

wb1.Close

Sid
0
 

Author Comment

by:BBlu
ID: 35012703

Man,that is fantastic!  Thanks, Sid.  People like you have really helped expedite my learning.  I have questions, I ask for help, and then I'm able to read the code to gradually learn how all of the pieces (of code) work.  Thank you very much for taking the time to help.  
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35012724
You are welcome :)

Sid
0
 

Author Closing Comment

by:BBlu
ID: 35012752
I almost feel like it's cheating getting such AMAZING and quick help.  You guys make me look like a Rock Star at work!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

733 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