NUC_N_FUTS2
New Member
- Joined
- Nov 8, 2024
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
Hello,
I have ActiveX Option Buttons on one Sheet and once clicked, would like to go to another sheet and sort data then update a combobox with the sorted data.
There are 4 Option buttons in a group that will sort the data in another sheet based on option button clicked, and then update the ListFillRange and ComboWidths.
When I click the button, nothing happens.
Here is the code located in Module 1:
Not sure what i am doing wrong here. I kept screenupdating as True so I can see what is happening. The sort doesn't happen.
Can anyone help?
Thanks in advaice.
Nuc
I have ActiveX Option Buttons on one Sheet and once clicked, would like to go to another sheet and sort data then update a combobox with the sorted data.
There are 4 Option buttons in a group that will sort the data in another sheet based on option button clicked, and then update the ListFillRange and ComboWidths.
When I click the button, nothing happens.
Here is the code located in Module 1:
VBA Code:
Option Explicit
Private Sub OptPartNo_Click()
Application.ScreenUpdating = True
If OptPartNo.Value = True Then
Sheets("Table").Select
Range("B4:CG6566").Select
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Table").Sort.SortFields.Add2 Key:=Range("D4:D6566" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Table").Sort
.SetRange Range("B4:CG6566")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("Sheet1").Select
With cmbDatabase
.ListFillRange = "SEARCH"
.ColumnWidths = "0 pt;0 pt;0 pt;108 pt;144 pt;108 pt;108 pt;49.95"
End With
End If
Application.ScreenUpdating = True
End Sub
Not sure what i am doing wrong here. I kept screenupdating as True so I can see what is happening. The sort doesn't happen.
Can anyone help?
Thanks in advaice.
Nuc