Solved

Dashboard Details via "Link"

Posted on 2011-03-01
9
329 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

770 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