ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Lookup cell address of listbox selection (https://www.excelbanter.com/excel-programming/418962-lookup-cell-address-listbox-selection.html)

LaDdIe

Lookup cell address of listbox selection
 
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.

redeagle

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.


LaDdIe

Lookup cell address of listbox selection
 
Bless ur heart!, just what I wanted.

"redeagle" wrote:

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.



All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com