LogheadLeech
New Member
- Joined
- Sep 23, 2011
- Messages
- 3
Hello All,
Thank you in advance for any help offered on this most frustrating problem.
Details
I have a Userform with a listview on it. The user selects a row using the Up+Down arrows, then presses Enter to add detail to that row. This shows a second userform with controls for the info.
My problem is that once the second form has been closed, and the original form reactivated, I can't seem to get focus back to the Listview so that the user can carry on using Up+Down Arrows.
I've created a simplified example workbook that demonstrates my problem, http://www.mediafire.com/?pm2i1e2cwi2g2yb.
Code follows
Userform1:
Userform2:
Any and all help will be greatly appreciated. I devoted many hours of attempting to solve this last night and got nowhere.
Also, Awesome forum. Have honed my skills here over the past few years and will be looking to help others as much as possible.
Paul
Thank you in advance for any help offered on this most frustrating problem.
Details
I have a Userform with a listview on it. The user selects a row using the Up+Down arrows, then presses Enter to add detail to that row. This shows a second userform with controls for the info.
My problem is that once the second form has been closed, and the original form reactivated, I can't seem to get focus back to the Listview so that the user can carry on using Up+Down Arrows.
I've created a simplified example workbook that demonstrates my problem, http://www.mediafire.com/?pm2i1e2cwi2g2yb.
Code follows
Userform1:
Code:
Private Sub ListView1_KeyDown(KeyCode As Integer, ByVal Shift As Integer)
Dim i As Integer
Select Case Shift
Case 0
'Shift not pressed
Select Case KeyCode
Case 13
'Enter button pressed
'This line shows Userform2, and returns the selection, all fine
Label1.Caption = "You selected " & UserForm2.GatherData
'However, this line (and all others I've tried) does not return focus to the listview
ListView1.SetFocus
End Select
End Select
End Sub
Userform2:
Code:
Public Function GatherData() As String
Me.Show
GatherData = ComboBox1.Text
End Function
Any and all help will be greatly appreciated. I devoted many hours of attempting to solve this last night and got nowhere.
Also, Awesome forum. Have honed my skills here over the past few years and will be looking to help others as much as possible.
Paul