hello
i using below code to filter data using checkboxe. but when i play userform there is coming a debug "unable to get the OLEObjects property of the worksheet class"
plz solve the problem
thanx
Option Explicit
Sub Filter_Me()
Dim LR As Long
Dim objcBox As Object
Dim cBox As Variant
ReDim cBox(0)
Application.ScreenUpdating = False
With Sheets("ENTRY")
.AutoFilterMode = False
LR = .Cells.Find("*", .Cells(Rows.count, .Columns.count), SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For Each objcBox In .OLEObjects
If TypeName(objcBox.Object) = "CheckBox" Then
If objcBox.Object.Value = True Then
cBox(UBound(cBox)) = objcBox.Object.Caption
ReDim Preserve cBox(UBound(cBox) + 1)
End If
End If
Next
If IsError(Application.Match("*", (cBox), 0)) Then
'MsgBox "Nothing Selected"
Exit Sub
End If
ReDim Preserve cBox(UBound(cBox) - 1)
If Not .AutoFilterMode Then
.Range("A10").AutoFilter
.Range("A9:AG" & LR).AutoFilter Field:=3, Criteria1:=Array(cBox), Operator:=xlFilterValues
End If
End With
Application.ScreenUpdating = True
End Sub
Bookmarks