Okay....thanks! Another question if you don't mind...
I would like to hide all the drop down arrows from the autofilter. I have found a little macro that will perform this for me but I'm not sure where to insert the "call" line item that will call this other macro. When I place it down at the bottom just before the "application.screenupdating = true" it hides the drop down arrows but then doesn't filter my data. Maybe you have a better way of performing this task. See below for what I have done...
This is where i have inserted the "call"...
Sub Filter_Sheet()
Dim LR As Long
Dim cBoxB As Variant
Dim cboxC As Variant
Dim cboxD As Variant
Dim cboxF As Variant
Dim B As Long
Dim c As Long
Dim D As Long
Dim F As Long
ReDim cBoxB(0)
ReDim cboxC(0)
ReDim cboxD(0)
ReDim cboxF(0)
If Flag = True Then Exit Sub
Application.ScreenUpdating = False
With Sheets("Dashboard")
.AutoFilterMode = False
LR = .Cells.Find("*", .Cells(Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For B = 2 To 15
If .OLEObjects("Checkbox" & CStr(B)).Object.Value = True Then
cBoxB(UBound(cBoxB)) = .OLEObjects("Checkbox" & CStr(B)).Object.Caption
ReDim Preserve cBoxB(UBound(cBoxB) + 1)
End If
Next B
On Error Resume Next
ReDim Preserve cBoxB(UBound(cBoxB) - 1)
On Error GoTo 0
For c = 17 To 19
If .OLEObjects("Checkbox" & CStr(c)).Object.Value = True Then
cboxC(UBound(cboxC)) = .OLEObjects("Checkbox" & CStr(c)).Object.Caption
ReDim Preserve cboxC(UBound(cboxC) + 1)
End If
Next c
On Error Resume Next
ReDim Preserve cboxC(UBound(cboxC) - 1)
On Error GoTo 0
For D = 21 To 28
If .OLEObjects("Checkbox" & CStr(D)).Object.Value = True Then
cboxD(UBound(cboxD)) = .OLEObjects("Checkbox" & CStr(D)).Object.Caption
ReDim Preserve cboxD(UBound(cboxD) + 1)
End If
Next D
On Error Resume Next
ReDim Preserve cboxD(UBound(cboxD) - 1)
On Error GoTo 0
For F = 30 To 31
If .OLEObjects("Checkbox" & CStr(F)).Object.Value = True Then
cboxF(UBound(cboxF)) = .OLEObjects("Checkbox" & CStr(F)).Object.Caption
ReDim Preserve cboxF(UBound(cboxF) + 1)
End If
Next F
On Error Resume Next
ReDim Preserve cboxF(UBound(cboxF) - 1)
On Error GoTo 0
If IsError(Application.Match("*", (cBoxB), 0)) Then
MsgBox "No Fund/JV Selected. Showing all data."
Exit Sub
End If
If Not .AutoFilterMode Then
.Range("A32").AutoFilter
.Range("A32:J" & LR).AutoFilter Field:=2, Criteria1:=Array(cBoxB), Operator:=xlFilterValues
If Not IsError(Application.Match("*", (cboxC), 0)) Then
.Range("A32:J" & LR).AutoFilter Field:=3, Criteria1:=Array(cboxC), Operator:=xlFilterValues
End If
If Not IsError(Application.Match("*", (cboxD), 0)) Then
.Range("A32:J" & LR).AutoFilter Field:=4, Criteria1:=Array(cboxD), Operator:=xlFilterValues
End If
If Not IsError(Application.Match("*", (cboxF), 0)) Then
.Range("A32:J" & LR).AutoFilter Field:=7, Criteria1:=Array(cboxF), Operator:=xlFilterValues
End If
End If
End With
Call HideArrows
Application.ScreenUpdating = True
End Sub
And this is the macro that its calling...
Sub HideArrows()
'hides all arrows except column 11
Dim c As Range
Dim i As Integer
i = Cells(31, 1).End(xlToRight).Column
For Each c In Range(Cells(31, 1), Cells(31, i))
If c.Column <> 11 Then
c.AutoFilter Field:=c.Column, _
Visibledropdown:=False
End If
Next
End Sub
Bookmarks