Solved

Combine Two Sheets

Posted on 2011-03-01
4
223 Views
Last Modified: 2012-06-21
I need to combine the Sheets 'Team Dashboard Wip' and 'New Layouts'..the issue is that they both have controls and some code. I get errors when I try. Using two sheets when it could be simplified would be preferable, right?
Here is what I would like:
Move the 'New Layouts' content into 'Team Dashboard WIP' and use the control at the top of 'Team Dashboard WIP' to select the person and the appropriate data.
dashboard-wipv2.xlsm
0
Comment
Question by:singleton2787
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35009606
Like this? Sample File Attached.

Sid

Code Used

Private Sub Worksheet_change(ByVal Target As Range)
    If Not Intersect(Target, Range("E5")) Is Nothing Then
        Dim acell As Range
        
        Set acell = Sheets("Graph Data Entry").Columns(1).Find(What:=Range("E5").Value, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)
    
        If Not acell Is Nothing Then
            Range("E9").Value = acell.Offset(2, 2).Value
            Range("E10").Value = acell.Offset(4, 2).Value
            Range("E11").Value = acell.Offset(6, 2).Value
            Range("E12").Value = acell.Offset(7, 2).Value
            Range("F9").Value = acell.Offset(2, 3).Value
            Range("F10").Value = acell.Offset(4, 3).Value
            Range("F11").Value = acell.Offset(6, 3).Value
            Range("F12").Value = acell.Offset(7, 3).Value
            Range("G9").Value = acell.Offset(2, 4).Value
            Range("G10").Value = acell.Offset(4, 4).Value
            Range("G11").Value = acell.Offset(6, 4).Value
            Range("G12").Value = acell.Offset(7, 4).Value
            Range("H9").Value = acell.Offset(2, 5).Value
            Range("H10").Value = acell.Offset(4, 5).Value
            Range("H11").Value = acell.Offset(6, 5).Value
            Range("H12").Value = acell.Offset(7, 5).Value
         
        End If
    ElseIf Not Intersect(Target, Range("E18")) Is Nothing Then
        Range("E21:E29").ClearContents
        For I = 1 To 100
            If Sheets("Data").Cells(1, I) = Range("E18").Value Then
                For J = 21 To 29
                    ActiveSheet.Cells(J, 5).Value = Sheets("Data").Cells(J - 19, I)
                Next J
                Exit For
            End If
        Next
    End If
End Sub

Open in new window

Dashboard-wip.xlsm
0
 

Author Comment

by:singleton2787
ID: 35009833
Almost!!
If we can just remove the control at E18 (the lower one) and just make E5 the control that displays all the data and graph, that would be optimal, thanks!!!
0
 
LVL 30

Accepted Solution

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

Sid

Code Used

Dim acell As Range

Private Sub Worksheet_change(ByVal Target As Range)
    If Not Intersect(Target, Range("E5")) Is Nothing Then
        Set acell = Sheets("Graph Data Entry").Columns(1).Find(What:=Range("E5").Value, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)
    
        If Not acell Is Nothing Then
            Range("E9").Value = acell.Offset(2, 2).Value
            Range("E10").Value = acell.Offset(4, 2).Value
            Range("E11").Value = acell.Offset(6, 2).Value
            Range("E12").Value = acell.Offset(7, 2).Value
            Range("F9").Value = acell.Offset(2, 3).Value
            Range("F10").Value = acell.Offset(4, 3).Value
            Range("F11").Value = acell.Offset(6, 3).Value
            Range("F12").Value = acell.Offset(7, 3).Value
            Range("G9").Value = acell.Offset(2, 4).Value
            Range("G10").Value = acell.Offset(4, 4).Value
            Range("G11").Value = acell.Offset(6, 4).Value
            Range("G12").Value = acell.Offset(7, 4).Value
            Range("H9").Value = acell.Offset(2, 5).Value
            Range("H10").Value = acell.Offset(4, 5).Value
            Range("H11").Value = acell.Offset(6, 5).Value
            Range("H12").Value = acell.Offset(7, 5).Value
         
        End If
        Range("E21:E29").ClearContents
        For I = 1 To 100
            If InStr(1, Sheets("Data").Cells(1, I), Range("E5").Value, vbTextCompare) Then
                For J = 21 To 29
                    ActiveSheet.Cells(J, 5).Value = Sheets("Data").Cells(J - 19, I)
                Next J
                Exit For
            End If
        Next
    End If
End Sub

Open in new window

Dashboard-wip.xlsm
0
 

Author Closing Comment

by:singleton2787
ID: 35010941
You are the man!! Thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now