Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel data validation

Status
Not open for further replies.

Leslie67

Programmer
Jul 23, 2002
42
US
I have data validation set up in excel to provide input messages when a cell is active ("Click Yes or No").

The "Yes" and "No" are checkboxes.

When "No" is clicked the cell in the next row becomes active by using "Range("a26").activate"

The problem is that when "A26" becomes active, the corresponding input message isn't the one for "A26", it's for the cell that *was* active.

Any suggestions?
 
Have you tried Range("A26").Select?

I'm not sure if it helps, let me know and I will look into it further.



If you can't be "The Best", be the best at what you can!!!

Never say Never!!!
Nothing is impossible!!!
 
Yes, I tried .select and it does the same thing.

The other really funky thing about this is that if you click the "no" checkbox, then *un*click the "no", then click the "no" AGAIN, then the right cell has the focus and the right message pops up.

I'm sure it has something to do with the focus and the order that things are happening, but I can't figure it.

 
Where do you have the Range("A26").activate line (i.e. in which module)?



If you can't be "The Best", be the best at what you can!!!

Never say Never!!!
Nothing is impossible!!!
 
I have it on the "click" event for the chkbox:

Private Sub chkmovephoneno_Click()
If chkmovephoneno = True Then
Range("A26").Activate
End If

End Sub
 
Try using both .Select and .activate:

Code:
Private Sub chkmovephoneno_Click()
If chkmovephoneno = True Then
    Range("A26").Select
    Range("A26").Activate
End If

End Sub

or:

Code:
Private Sub chkmovephoneno_Click()
If chkmovephoneno = True Then
    Range("A26").Activate
    Range("A26").Select
End If

End Sub

I'm not sure if the first one won't cause the Input message to be called, so you might want to try the second one first.

Hope this helps!



If you can't be "The Best", be the best at what you can!!!

Never say Never!!!
Nothing is impossible!!!
 
ok.... I tried that and I've still got the same issue.

I'm wondering if the focus is never acually getting to the new cell because when I step through the code it just keeps going around and around in the "click" event for the "no" button...

 
actually, I have proved that the cell does, indeed, become the active one using this message. Now it's a data validation question, I htink..

Thanks for you help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top