View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
redeagle redeagle is offline
external usenet poster
 
Posts: 12
Default Lookup cell address of listbox selection

Hi LaDdIe-

I have something done something similar but with worksheets. Basically when
my userform loads it populates a listbox with all the worksheet names in the
workbook. Then when I click on the listbox, it takes me to that worksheet.

All the listbox_change() event does is loop through all the worksheet names
and when it finds a match it goes to that sheet.

Private Sub ListBox1_Change()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
If Me.ListBox1.Value = ws.Name Then
ws.Select
Exit Sub
End If
Next

End Sub

Maybe you could loop through the contents of the cells in the named range to
find a match in your listbox?

For each [cell] in [named range]
If Me.ListBox1.Value = [cell].value Then
cell.select
Exit Sub
End If
Next

.... or something to that effect.

John

"LaDdIe" wrote:

Hi.

Could someone help me to achive the following.
I have a Userform with a listbox,
The source of the listbox is named range on a sheet,

I would like that when the user double clicks on a listbox item that the
source cell on the sheet is activated.

The source range may at times be filtered, however I have configured the
listbox to show only the visible cells.

Thanks

LaDdIe.