#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default List Box Forms

I havea form that I have created with two list boxes. The macros
launches a filter. How do I create a property in the list box that
would allow a user to "deselect" the list box. Right now, once the
user clicks in the box, a name is highlighted and the only option is
the select another name. You can't click on a name again and deselect
it.

My code is:

Private Sub CommandButton1_Click()
vEmpSups = frmSupervisors.lstEmpSups.Value
vRoutesups = frmSupervisors.LstRouteSups.Value

Sheets("DispatchSheet").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=vEmpSups
Selection.AutoFilter Field:=2, Criteria1:=vRoutesups

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 292
Default List Box Forms

Hi

Something like

Private Sub BtnDeselect_Click()
frmSupervisors.lstEmpSups.Listindex = -1
End Sub

HTH. Best wishes Harald

"Nimish" skrev i melding
ps.com...
I havea form that I have created with two list boxes. The macros
launches a filter. How do I create a property in the list box that
would allow a user to "deselect" the list box. Right now, once the
user clicks in the box, a name is highlighted and the only option is
the select another name. You can't click on a name again and deselect
it.

My code is:

Private Sub CommandButton1_Click()
vEmpSups = frmSupervisors.lstEmpSups.Value
vRoutesups = frmSupervisors.LstRouteSups.Value

Sheets("DispatchSheet").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=vEmpSups
Selection.AutoFilter Field:=2, Criteria1:=vRoutesups

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default List Box Forms

Where would I place that sub....in my forms macro? How does it fit in
with the coding?

Thanks


Harald Staff wrote:
Hi

Something like

Private Sub BtnDeselect_Click()
frmSupervisors.lstEmpSups.Listindex = -1
End Sub

HTH. Best wishes Harald

"Nimish" skrev i melding
ps.com...
I havea form that I have created with two list boxes. The macros
launches a filter. How do I create a property in the list box that
would allow a user to "deselect" the list box. Right now, once the
user clicks in the box, a name is highlighted and the only option is
the select another name. You can't click on a name again and deselect
it.

My code is:

Private Sub CommandButton1_Click()
vEmpSups = frmSupervisors.lstEmpSups.Value
vRoutesups = frmSupervisors.LstRouteSups.Value

Sheets("DispatchSheet").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=vEmpSups
Selection.AutoFilter Field:=2, Criteria1:=vRoutesups

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,327
Default List Box Forms

That would depend on how and when you want this deselection to happen. But
if it's a "deselect" commandbutton on the form, then it goes inside that
one's click event.

Your provided code is a little confusing. If Private Sub
CommandButton1_Click() is inside ther form's own module then you should
address its controls with Me instead of the form's name. Not

vEmpSups = frmSupervisors.lstEmpSups.Value
vRoutesups = frmSupervisors.LstRouteSups.Value

but

vEmpSups = Me.lstEmpSups.Value
vRoutesups = Me.LstRouteSups.Value

Same goes for the code I wrote you.

HTH. Best wishes Harald

"Nimish" skrev i melding
oups.com...
Where would I place that sub....in my forms macro? How does it fit in
with the coding?

Thanks


Harald Staff wrote:
Hi

Something like

Private Sub BtnDeselect_Click()
frmSupervisors.lstEmpSups.Listindex = -1
End Sub

HTH. Best wishes Harald

"Nimish" skrev i melding
ps.com...
I havea form that I have created with two list boxes. The macros
launches a filter. How do I create a property in the list box that
would allow a user to "deselect" the list box. Right now, once the
user clicks in the box, a name is highlighted and the only option is
the select another name. You can't click on a name again and deselect
it.

My code is:

Private Sub CommandButton1_Click()
vEmpSups = frmSupervisors.lstEmpSups.Value
vRoutesups = frmSupervisors.LstRouteSups.Value

Sheets("DispatchSheet").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=vEmpSups
Selection.AutoFilter Field:=2, Criteria1:=vRoutesups

End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formatting the list items for ComboBox created using Forms Desmond Excel Discussion (Misc queries) 3 May 4th 06 10:04 AM
data validation--multiple dependent list Michael Excel Discussion (Misc queries) 9 May 2nd 06 01:14 AM
Check 2 different list get associated value from a column deja Excel Worksheet Functions 1 April 20th 06 04:11 AM
Drop-down list Populated by a Subset of a larger list RJH Excel Worksheet Functions 3 March 31st 06 10:28 PM
Refresh a Validation List? jhollin1138 Excel Discussion (Misc queries) 3 February 17th 05 05:48 PM


All times are GMT +1. The time now is 03:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"