ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   State Map, Mouse Position Question (https://www.excelbanter.com/excel-programming/373322-state-map-mouse-position-question.html)

[email protected]

State Map, Mouse Position Question
 
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



All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com