ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox MultiSelectMulti mode (https://www.excelbanter.com/excel-programming/339835-listbox-multiselectmulti-mode.html)

CG Rosén

ListBox MultiSelectMulti mode
 
Good Evening Group,

Below code works fine when my ListBox is in normal mode. But how to rewrite
the
code to work in MultiSelectMulti mode?
Hope for your skilled assistance.

Brgds

CG Rosén

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

With Blad1.Range("A1:A100")

Set k = .Find(UserForm1.ListBox1.Text, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)

If Not k Is Nothing Then

r = k.Row

Sheet1.Cells(r, 1).ClearContents

End If

End With




Tom Ogilvy

ListBox MultiSelectMulti mode
 
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

With Blad1.Range("A1:A100")
for i = 0 to Listbox1.ListCount -1
if Listbox1.Selected(i) then
Set k = .Find(UserForm1.ListBox1.List(i,0), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)

If Not k Is Nothing Then
r = k.Row
Sheet1.Cells(r, 1).ClearContents
end if
End If
Next
End With

--
Regards,
Tom Ogilvy

"CG Rosén" wrote in message
...
Good Evening Group,

Below code works fine when my ListBox is in normal mode. But how to

rewrite
the
code to work in MultiSelectMulti mode?
Hope for your skilled assistance.

Brgds

CG Rosén

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

With Blad1.Range("A1:A100")

Set k = .Find(UserForm1.ListBox1.Text, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)

If Not k Is Nothing Then

r = k.Row

Sheet1.Cells(r, 1).ClearContents

End If

End With







All times are GMT +1. The time now is 03:01 AM.

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