ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Evening,
I have a userform with a listbox.
I would like to select an entry in the listbox & be taken to that person on the worksheet.
I have on the userform another code which uses the entry i select so i can just select & be taken there, Hence why i need to select the entry then have the code on a command button
Some Info for you.
ListBox is called ListBoxSearch
Worksheet called DATABASE
Column A is where it needs to be selected.
I have the code below which i thought would work but i get a run time error,as shown in screenshot
I have a userform with a listbox.
I would like to select an entry in the listbox & be taken to that person on the worksheet.
I have on the userform another code which uses the entry i select so i can just select & be taken there, Hence why i need to select the entry then have the code on a command button
Some Info for you.
ListBox is called ListBoxSearch
Worksheet called DATABASE
Column A is where it needs to be selected.
I have the code below which i thought would work but i get a run time error,as shown in screenshot
VBA Code:
Private Sub GoToCustomerButton_Click()
Dim answer As Integer
Range("A" & ListBoxSearch.List(ListBoxSearch.ListIndex, 1)).Select
answer = MsgBox("GO TO CUSTOMER IN DATABASE ?", vbYesNo + vbInformation, "OPEN DATABASE MESSAGE")
If answer = vbYes Then
Unload FindAndReplaceDatabase
Database.LoadData Sheets("DATABASE"), Selection.Row
Else
Unload FindAndReplaceDatabase
End If
End Sub