- ©«¤l
- 552
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 578
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-2-8
- ³Ì«áµn¿ý
- 2024-7-9
|
¦^´_ 20# mark761222
¦b¶×¥X¸ê®Æ¦b¤¤ªº¤u§@ªí¦WºÙ©M¥Øªºªº¤u§@ªí¦WºÙ¦³»~¡A¥i¯à¬O¦]¬°ªÅ®æªºÃö«Y¡A½Ð¦Û¦æ×¥¿§_«h·|¦³
ªº¿ù»~²£¥Í- Sub «ö¶s1_Click()
- Application.ScreenUpdating = False
- Dim d As Object
- Dim xlPath As Variant, xlFile As Variant, aa As Variant
- Dim Rng As Range, Rn As Range, Ran As Range, ch As Range
- Dim myRow As Integer, myCol As Integer, k As Integer, I As Integer, j As Integer, xlRow As Integer
- xlPath = ThisWorkbook.Path & "\"
- Set d = CreateObject("scripting.dictionary") '³]©wd¬°¦r¨åª«¥ó
- With Sheets("¶×¥X¸ê®Æ")
- For Each Rng In .Range("A3", Cells(Rows.Count, 1).End(xlUp)) '¦¹°j°é¬OŪ¨úÀɮצWºÙ
- If Rng <> "" Then
- d(Rng.Value) = ""
- End If
- Next
- myRow = .Cells(Rows.Count, 1).End(xlUp).Row '¬d¸ß"¶×¥X¸ê®Æ"ªº³Ì«á¤@¦C¦ì¸m
- For Each Rng In .Range("B2", .Cells(myRow, 2)) '¦¹°j°é°µ ¦³¸ê®ÆRange¦ì¸mªºÁp¶° Union¡AŪ¨ú¤u§@ªí¦WºÙ
- If Rng <> "" Then
- k = k + 1
- If k = 1 Then
- Set Rn = Rng
- Else
- Set Rn = Union(Rn, Rng)
- End If
- End If
- Next
- End With
- xlFile = d.keys '±N¦r¨åªºkeyȵ¹¤©xlFile(¬°°}¦C)¡A¥H¥Ø«eŪ¨úªºÀɮצWºÙ¦³"Daily Yield Rate report ¤À¼t 2015BR"
- '¥H¤Î"Daily Yield Rate report(EN)2015BR4"2ÓÀÉ®×
-
- For I = 0 To UBound(xlFile) '¥HÀɮ׬°°µ¬°°j°é¡A¨Ó¶}±ÒÀÉ®×
- With Workbooks.Open(xlPath & xlFile(I) & ".xlsx") '¶}±ÒÀÉ®×
- For Each Ran In Rn '°õ¦æ¤u§@ªí°j°é
- If Ran.Offset(, -1) Like xlFile(I) Then '¤ñ¹ï¦¹¤u§@ªí¬O§_ÄÝ©óxlFile(I)ÀɮסA¦pªG¬O«h°õ¦æIf¤¤µ{§Ç
- With .Sheets(Ran.Value)
- Set ch = .Columns(1).Find(Ran.Offset(, 1), LookAt:=xlWhole, SearchDirection:=2)
- 'Àˬd¤é´Á¬O§_¦³«½Æ¡A·íchÅܼƬ°Nothing®É¡A«hµLµo²{«½Æ¤é´Á¡A§_«hÂ÷¶}³o¤@¦¸ªº¸ê®ÆÀx¦s¡A¨Ã°õ¦æ¤U¤@Ó°j°é
- If Not ch Is Nothing Then MsgBox Ran & "¤u§@ªí¤¤ªº" & ch & "¸ê®Æ¤w¦s¦b¡A¤£·|Àx¦s¸ê®Æ": Set ch = Nothing: GoTo 10
- myCol = ThisWorkbook.Sheets("¶×¥X¸ê®Æ").Cells(Ran.Row, Columns.Count).End(xlToLeft).Column
- xlRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1 'Ū¨ú¥Øªº¤u§@ªíªº³Ì«á¤@¦C¦C¸¹
- For j = 1 To myCol - 2
- If Ran.Offset(, j).Interior.Color <> 65535 Then '·íÀx¦s®æ¦â±m¤£ÄÝ©ó¶À¦â¡A«h°õ¦æ½Æ»sÈ
- .Cells(xlRow, j) = Ran.Offset(, j).Value '½Æ»sÈ
- End If
- Next
- 10:
- End With
- End If
- Next '§¹¦¨¤@Ó¤u§@ªí«á°õ¦æ¤U¤@Ó¤u§@ªí
- .Close True 'Ãö³¬¤ÎÀx¦sÀÉ®×
- End With
- Next
- Application.ScreenUpdating = False
- End Sub
½Æ»s¥N½X |
|