Reputation: 33
I have this below code which I use for viewing images on Userform, depending on Target.Value in Range("A1:A200")
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim MyPath As String
Dim MyPic As String
MyPath = "C:\Users\Public\Pictures\Sample Pictures\"
On Error GoTo error_handler:
If Intersect(Target, Range("a1:a200")) Is Nothing Then Exit Sub
MyPic = Target.Value & ".jpg"
UserForm2.Image1.Picture = LoadPicture(MyPath & MyPic)
UserForm2.Show vbModeless
error_handler:
Exit Sub
End Sub
The problem I am encountering with this script is that I am not able to change my active cell with my arrow keys.
How do i fix this?
Upvotes: 1
Views: 81
Reputation: 585
The issue is that the userform, though modeless, still has the focus.
There's a solution here that worked for me: cpearson.com SetFocus
Upvotes: 1