Function executeAdvancedFilter(ByRef dataSheetName As String, ByRef conditions As Variant) As Variant
With ActiveWorkbook.Worksheets(dataSheetName)
If .Cells(10, 1).CurrentRegion.Rows.Count > 1 Then
'조건
If .Cells(1, 1).Value <> Empty Then
.Cells(1, 1).CurrentRegion.ClearContents
End If
.Cells(1, 1).Resize(UBound(conditions, 1), UBound(conditions, 2)) = conditions
'필터링
.Cells(10, 1).CurrentRegion.AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=.Cells(1, 1).CurrentRegion, _
CopyToRange:=Worksheets("clipboard").Cells(1, 1), _
Unique:=False
'결과값을 배열로
With ActiveWorkbook.Worksheets("clipboard")
If .Cells(1, 1).CurrentRegion.Rows.Count > 1 Then
executeAdvancedFilter = .Cells(2, 1).Resize(.Cells(1, 1).CurrentRegion.Rows.Count - 1, .Cells(1, 1).CurrentRegion.Columns.Count)
End If
.Cells(1, 1).CurrentRegion.clear
'.usedrange.clearcontents
End With
Else
'MsgBox "조회할 데이터가 없습니다."
End If
End With
이렇게 디버그가 오류가 났다고 합니다.
첫번째 탭 말고는 모두 그런거 같은데, 혹시 어떻게 해야 할까요?
(지금은 개인정보가 들어가 있어 파일을 올리긴 어렵습니다.)