M
Marty
Greetings:
I’m having difficulty getting a program to execute on a cell change (F31).
Cell F31 is actually a 1R x 5C range of cells (F31-J31 merged) with a
validation list. There are three possibilities in the list. The text for
each possibility is long, but for simplicity, assume that I need all five
cells and the values in the list are X, Y and Z. When the user selects a
value from the list in F31, cells F59 and F67 should change.
If the user chooses X in F31, I want F59 to show “Yes†and F67 to show “Noâ€.
If the user chooses Y in F31, I want F59 to show “No†and F67 to show “Yesâ€.
If the user chooses Z in F31, I want F59 to show “Yes†and F67 to show “Yesâ€.
If the user deletes the entry in F31, I want both F59 and F67 to go blank.
The first three “Ifs†above work fine. However, when I delete an entry in
F31, F59 and F67 do not change.
Here is the relevant part of the code:
If Target.Address = "$F$31" Then
If MM.Range("F31") = "X" Then
MM.Cells(59, 6) = "Yes"
MM.Cells(67, 6) = "No"
ElseIf MM.Range("F31") = "Y" Then
MM.Cells(59, 6) = "No"
MM.Cells(67, 6) = "Yes"
ElseIf MM.Range("F31") = "Z" Then
MM.Cells(59, 6) = "Yes"
MM.Cells(67, 6) = "Yes"
Else
MM.Cells(59, 6) = ""
MM.Cells(67, 6) = ""
End If
End If
I notice that it DOES work if I unmerge the cells (and use ONLY F31 for
real), but I really do need the five-cell range.
Any ideas as to how I can get this to work? Help is appreciated.
I’m having difficulty getting a program to execute on a cell change (F31).
Cell F31 is actually a 1R x 5C range of cells (F31-J31 merged) with a
validation list. There are three possibilities in the list. The text for
each possibility is long, but for simplicity, assume that I need all five
cells and the values in the list are X, Y and Z. When the user selects a
value from the list in F31, cells F59 and F67 should change.
If the user chooses X in F31, I want F59 to show “Yes†and F67 to show “Noâ€.
If the user chooses Y in F31, I want F59 to show “No†and F67 to show “Yesâ€.
If the user chooses Z in F31, I want F59 to show “Yes†and F67 to show “Yesâ€.
If the user deletes the entry in F31, I want both F59 and F67 to go blank.
The first three “Ifs†above work fine. However, when I delete an entry in
F31, F59 and F67 do not change.
Here is the relevant part of the code:
If Target.Address = "$F$31" Then
If MM.Range("F31") = "X" Then
MM.Cells(59, 6) = "Yes"
MM.Cells(67, 6) = "No"
ElseIf MM.Range("F31") = "Y" Then
MM.Cells(59, 6) = "No"
MM.Cells(67, 6) = "Yes"
ElseIf MM.Range("F31") = "Z" Then
MM.Cells(59, 6) = "Yes"
MM.Cells(67, 6) = "Yes"
Else
MM.Cells(59, 6) = ""
MM.Cells(67, 6) = ""
End If
End If
I notice that it DOES work if I unmerge the cells (and use ONLY F31 for
real), but I really do need the five-cell range.
Any ideas as to how I can get this to work? Help is appreciated.