Lookup cell address of listbox selection

L

LaDdIe

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.
 
R

redeagle

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
 
L

LaDdIe

Bless ur heart!, just what I wanted.

redeagle said:
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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top