State Map, Mouse Position Question

R

rons

Greetings,

Using Excel 2003, have a userform with an image of the US States.
What's a good way to show which state i am hovering over and have a
mouse click event return the state name.

I was trying to use the mouse move x, y, but this only works for me if
the state is semi-square, unsure how to do it for Texas, California,
Idaho, etc.


code snipet...
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Xval >= 35 And Xval <= 51 And YVal >= 16 And YVal <= 24 Then
UserForm1.Caption = "Washington"
Else

If Xval >= 32.25 And Xval <= 59 And YVal >= 38.25 And YVal <= 56 Then
UserForm1.Caption = "Oregon"
Else
UserForm1.Caption = X & " XVal" & " " & Y & " YVal"
End IF
End If

Thank you
RonS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top