2011-09-21 9 views
0

Excel 필터처럼 작동해야하는 하나의 매크로를 작성하고 싶습니다. 이 필터를 사용하여 모든 데이터를 가져온 후 새 워크 시트에 붙여 넣으려고합니다. 시트 1 및 복사에Excel 매크로 필터

+0

당신은 이런 것들에 대한 매크로를 기록 시도해야합니다. 그런 다음 코드를 맞게 조정하십시오. – Reafidy

답변

1

이 하위 필터 값이 0 범위 A1을 삽입하거나하는

Sub FilterAndCopy() 
'Developer by Bruno Leite 
'http://officevb.com 

Dim Sht As Worksheet 
Dim FilterRange As Range 

'Set your Sheet 
Set Sht = ThisWorkbook.Sheets("Sheet1") 
'Verify if is Filter 

If Sht.FilterMode Then 
     Sht.ShowAllData 
End If 

'Filter Column A with 0 at parameter 
Sht.Range("A:A").AutoFilter Field:=1, Criteria1:="0" 

'Define Range Of Visible cells without row title 
Set FilterRange = Sht.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells(xlCellTypeVisible) 

FilterRange.Copy Sheets("Sheet2").Range("A1") 

Sht.ShowAllData 

End Sub 

[]의