Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
formatting the list items for ComboBox created using Forms | Excel Discussion (Misc queries) | |||
data validation--multiple dependent list | Excel Discussion (Misc queries) | |||
Check 2 different list get associated value from a column | Excel Worksheet Functions | |||
Drop-down list Populated by a Subset of a larger list | Excel Worksheet Functions | |||
Refresh a Validation List? | Excel Discussion (Misc queries) |