- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 5# jiunyanwu
·s¼W¼Ò²Õ¦Ü°ò·Ç¸ê®Æ®w , ½Æ»s¶K¤W¥N½X , ¦s¦¨xlsm- Sub Test()
- Dim f, i, r
- Dim arName() As String
- Dim wb As Workbook
-
- f = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls*),*.xls*", Title:="¿ï¾Ü¤ñ¹ïÀÉ®×", MultiSelect:=True)
- If Not IsArray(f) Then Exit Sub
-
- With Sheets("°ò·Ç¸ê®Æ®w")
- For Each it In .Range("A1:A4,B1:B2") 'n¿z¿ïªº¦r
- If it <> "" Then
- If i = 0 Then
- ReDim arName(i)
- Else
- ReDim Preserve arName(i)
- End If
- arName(i) = "=""=*" & it & "*"""
- i = i + 1
- End If
- Next
- End With
-
- Set wb = Workbooks.Add
- With wb
- With .Sheets(1)
- .Name = "Criteria"
- .[A1:C1] = Array("¥N¸¹", "¹q¸Ü", "¸ê®Æ") 'Write Header
- .[C2].Resize(UBound(arName)).Value = Application.Transpose(arName) 'Write Criteria
- End With
- .Sheets(2).Name = "¿z¿ïµ²ªG"
- End With
-
-
- r = 1
- For Each it In f
- With Workbooks.Open(it).Sheets(1)
- '¶i¶¥¿z¿ï
- .Range("A1:C6").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=wb.Sheets(1).[A1].CurrentRegion, CopyToRange:=wb.Sheets(2).Range("A" & r), Unique:=False
- .Parent.Close False
- End With
- With wb.Sheets(2)
- If r > 1 Then .Rows(r).Delete xlShiftUp 'Delete Header
- r = .Range("A" & .Rows.Count).End(xlUp).Row + 1
- End With
- Next
- End Sub
½Æ»s¥N½X |
|