We help IT Professionals succeed at work.

Changing data displayed on a worksheet using drop-down box and second worksheet

jmcclosk
jmcclosk asked
on
338 Views
Last Modified: 2014-05-12
I have two worksheets in a workbook.  The first worksheet is just a classic table of data for every single pallet location in a warehouse (upwards of 20,000 rows).  For each location, there are eight fields of data:

1. Cell# on worksheet 2 that corresponds to this location
2. Location
3. Area
4. Warea
5. Wzone
6. Capacity
7. Velocity
8. Travel Seq

The second worksheet is a visual layout of the warehouse with each cell being a unique location relating to one of the rows in the first worksheet.

In Cell A1 of the second worksheet, I have a drop-down list where the end user can select any one of the seven fields (not including Cell#).  When they make a choice, I want the second (visual) worksheet to update all 20,000 cells to display the piece of data associated with the users selection.

For example, if the user selected "Location", I want all 20,000 cells to display the unique location# associated with that cell#.  Then, if they select "Capacity", I want all 20,000 cells to update and show the pallet capacity for the location associated with that cell#.

I know how to make the worksheet update when the end user makes a selection.  But, I don't know how to write the formula for each cell on spreadsheet 2.

Would I use some kind of VLOOKUP formula?  If so, what syntax do I use to have it look up the curernt cell# as the lookup value?  And, how do I tell it how many columns to go to the right to get which piece of data depending on what the end user wants to see?
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Rory ArchibaldGrand Poobah
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I believe either of these solutions would work.  Mine was more complicated than these.  I was able to set up a way, with VBA, that when the option was selected by the end user for which data they wanted to see, cell $FZ$1 is updated with the column number for the corresponding data on Worksheet 1.  I then used the following formula in all of the cells on Worksheet 2 to automatically update the data to match that column:

VLOOKUP((ADDRESS(ROW(),COLUMN(),4)),AllData,$FZ$1,FALSE)

ADDRESS(ROW(),COLUMN(),4) returns the cell# of the current cell
AllData is the range I set up on Worksheet 1 where the data resides
$FZ$1 is the cell that holds the column number of the data the end user wants to see
FALSE tells the statement I want an exact match

I used the following VBA code to force the Worksheet to update immediately upon end user selection:

Private Sub Worksheet_Change(ByVal Target As Range)
   
    If Not Intersect(Range("A1"), Target) Is Nothing Then
           
        If Range("A1", "A1").Value = "LOCATION" Then
       
            Range("FZ1", "FZ1").Value = 2
            Exit Sub
        End If
       
        If Range("A1", "A1").Value = "AREA" Then
       
            Range("FZ1", "FZ1").Value = 3
            Exit Sub
        End If
       
        If Range("A1", "A1").Value = "WAREA" Then
       
            Range("FZ1", "FZ1").Value = 4
            Exit Sub
        End If
           
        If Range("A1", "A1").Value = "WZONE" Then
       
            Range("FZ1", "FZ1").Value = 5
            Exit Sub
        End If
       
        If Range("A1", "A1").Value = "CAPACITY" Then
       
            Range("FZ1", "FZ1").Value = 6
            Exit Sub
        End If
       
        If Range("A1", "A1").Value = "VELOCITY" Then
       
            Range("FZ1", "FZ1").Value = 7
            Exit Sub
        End If
       
        If Range("A1", "A1").Value = "TRAVEL SEQ" Then
       
            Range("FZ1", "FZ1").Value = 8
            Exit Sub
        End If

    End If
   
End Sub

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.