Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do delete or insert values in another cell based on validation selction in adjacent cell

Posted on 2011-03-07
6
Medium Priority
?
343 Views
Last Modified: 2012-05-11
Okay here is where I am at:

My friend and I are trying to creat a NCAA basket ball bracket in excel.  I am using validation dropdown lists to popolate the cells and then a second worksheet to create a new validation list for the next round based on what was selected previously.   This works great but I want to add the additional functionality that if they select someone in round of 32 then select the same team in the sweet 16 to win but decided that the team would actually lose in the previous round that any rounds after that would clear the name since it was selected to lose prior to that.   I am not sure if there is a way through VBA or someother method to make this happen.

I have attached my spreadsheet for reference.  

Thanks!
Test-Sheet-3.xlsm
0
Comment
Question by:Apex623
[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
  • 3
  • 2
6 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 2000 total points
ID: 35060913
Hi Apex,

You can use the attached code. BUT you will have to update your two championship games column so they start cleanly in row 6 and not row 7. From the way you designed your file, you shouldn't have any issues doing that.

Thomas

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cl As Range, i As Long, strTeam As String

If Not Intersect(Target, Range("D6:N38")) Is Nothing Then
    Application.EnableEvents = False
        For i = Target.Column + 1 To 9
            strTeam = Target.Offset(, i - Target.Column).MergeArea.Cells(1, 1)
            
            For Each cl In Target.Offset(, i - Target.Column).MergeArea.Cells
                If cl.Offset(, -1) = strTeam Then GoTo noIssueLeft
            Next
            
            Target.Offset(, i - Target.Column).MergeArea.ClearContents

noIssueLeft:
        Next i
        
        For i = Target.Column + 1 To 9 Step -1
            strTeam = Target.Offset(, i - Target.Column).MergeArea.Cells(1, 1)
            
            For Each cl In Target.Offset(, i - Target.Column).MergeArea.Cells
                If cl.Offset(, 1) = strTeam Then GoTo noIssueLeft
            Next
        
            Target.Offset(, i - Target.Column).MergeArea.ClearContents
noIssueRight:
        Next i
        
    Application.EnableEvents = True
End If

End Sub

Open in new window

0
 
LVL 5

Expert Comment

by:wellous
ID: 35060964
Hi,
<Quoted>
>>if they select someone in round of 32 then select the same team in the sweet 16 to win but decided that the team would actually lose in the previous round that any rounds after that would clear the name since it was selected to lose prior to that. <<
</Unquoted>
Yes , you are totally correct , what do you want the VBA to do for you ?
you stated in yr Validation lists that each cell from [Round of 32] is taking the Value from [Field of 64] and [Sweet 16] is taking from [Field of 64] so on .... then you will never find a previously lost team in the next Fields or round ever :) very logic!

Again , what VBA should do here ?

Thanks
Wellous

0
 
LVL 1

Author Comment

by:Apex623
ID: 35061181
nutsch:

I will work with what you gave me today and back with you on the results.  It may be tonight before I can run it but I am excited to give it a try and I will make the suggested change to the champion.  

Wellous:
I want the list to narrow each time to make sure they only select from teams that are available.  However the could select say Arizona in round of 32, and then again in sweet 16 but if they go back and change round of 32 to Utah I want it to delete Arizona from round of 16 since it is no longer a choice.  Does that make since?

Thanks again for the responses I will get going on this.  After all the tournament is right around the corner!
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 1

Author Comment

by:Apex623
ID: 35061318
Nutsch:  Actually I could not wait and put the code in my worksheet and it works perfect.  
0
 
LVL 1

Author Closing Comment

by:Apex623
ID: 35061330
Great job thanks for your help.  I am sure I will have more questions as I work on this.
0
 
LVL 39

Expert Comment

by:nutsch
ID: 35061723
Glad to help, thanks for the grade.

Thomas
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

661 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