Hi,
How can i combine two below macros into one? One of the macros sort the data and the other is for checkbox property.
First Macro
Second Macro
How can i combine two below macros into one? One of the macros sort the data and the other is for checkbox property.
First Macro
Code:
Option Explicit
Sub testme()
Dim ThisCBX As CheckBox
Dim CBX As CheckBox
Set ThisCBX = ActiveSheet.CheckBoxes(Application.Caller)
If ThisCBX.Value = xlOn Then
For Each CBX In ActiveSheet.CheckBoxes
If CBX.Name = ThisCBX.Name Then
'do nothing
Else
CBX.Value = xlOff
End If
Next CBX
End If
End Sub
Code:
Sub CheckBox3()
Application.ScreenUpdating = False
'Sub sbSortDataInExcelInDescendingOrder()
Dim strDataRange, strkeyRange As String
strDataRange = "C2:F13"
strkeyRange = "d3:d13"
With Sheets("Sheet2").Sort
.SortFields.Clear
.SortFields.Add _
Key:=Range(strkeyRange), _
SortOn:=xlSortOnValues, _
Order:=xlDescending, _
DataOption:=xlSortNormal
.SetRange Range(strDataRange)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.ScreenUpdating = True
End Sub