- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 45# prince0413
¨Ì11¤ëªºÀÉ®×.ªºµ{¦¡½X- Option Explicit
- Sub Ex()
- Dim Rng(1 To 4) As Range, i As Integer, ii As Integer, ¥X¶Ô As String, ¤é´Á As Variant, Print_x As Integer
- Dim ¥X¶Ô³æ As Range, E As Range, Sh As Worksheet, ¥X¶Ô¯Z§O()
- Set ¥X¶Ô³æ = Sheets("°²¤é¥X¶Ô³æ").Range("B3,D3,A5,B5,D5") '²Ä1±i¥X¶Ô³æn¾É¤J¸ê®Æªº¦ì¸m
- Set Rng(1) = Sheets("°²¤é¥X¶Ô³æ").Range("J2") '³]©wªÀû ^¤å,¤¤¤å,½s¸¹
- For i = 0 To 3 '¥X¶Ô³æ: ²Ä1±i¨ì ²Ä4±iªº¦ì¸m ¶¡®æ 14 ¦C
- ¥X¶Ô³æ.Offset(i * 14) = "" '²M°£ ¸ê®Æ
- Next
- Print_x = 0 '¦L¦C A4¯È±i ªºÅܼÆ
- Set Sh = Sheets("11¤ë") '***¦b«ü©w¤ë¥÷****
- Set Rng(4) = Sh.Cells.Find("¡°¥»¤ë°²¤é¥X¶Ô®É¬q", lookat:=xlWhole)
- Set Rng(4) = Sh.Range(Rng(4).Offset(2), Rng(4).Offset(2).End(xlDown)) '¥X¶Ô®É¶¡
- ¥X¶Ô¯Z§O = Application.WorksheetFunction.Transpose(Rng(4).Offset(, 5).Value) '¦.±ß...
-
- Do While Rng(1) <> "" '°õ¦æ°j°éªº±ø¥ó: ªÀû<>""
- '¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¨C¤ë»Ýק¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°
- With Sh
- '¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¨C¤ë»Ýק¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°¡°
- Set Rng(3) = Nothing 'ª«¥ó: ÄÀ©ñ
- Set Rng(2) = Sheets("¤¤^¤å©m¦W¹ï·Óªí").Range("A:C").Find(Rng(1), lookat:=xlWhole)
- '^¤å,¤¤¤å,½s¸¹:¸Ì·j´M
- If Not Rng(2) Is Nothing Then
- Set Rng(2) = Rng(2).Parent.Range("A" & Rng(2).Row) '^¤å,¤¤¤å,½s¸¹ªº²Ä¤@Äæ (^¤å)
- For i = 1 To 3 '¦pªÀû¬°¤¤¤å Sheets("11¤ë")¨S¦³ ¤¤¤å
- Set Rng(3) = Sh.Range("A:B").Find(Rng(2).Cells(i), lookat:=xlWhole)
- If Not Rng(3) Is Nothing Then Exit For '§ä¨ì ^¤å ©Î ½s¸¹
- Next
- End If
- If Not Rng(3) Is Nothing Then
- i = 3 '²Ä3Äæ :C
- Do While IsNumeric(.Cells(4, i)) '°õ¦æ°j°éªº±ø¥ó:²Ä4¦C¬O¼Æ¦r
- If (.Cells(5, i) = "¤»" Or .Cells(5, i) = "¤é") And Not IsError(Application.Match(.Cells(Rng(3).Row, i), ¥X¶Ô¯Z§O, 0)) Then
- 'Not IsError(Application.Match(.Cells(Rng(3).Row, i), ¥X¶Ô¯Z§O, 0)) -> '°²¤é¯Z§O¬O¦b[¥X¶Ô¯Z§O]¤¤
- ¥X¶Ô = "" 'Âk¹s
- For Each E In Rng(4) '¥»¤ë°²¤é¥X¶Ô®É¬q
- ¤é´Á = Split(E.Offset(, 1), "/")(1) '§R±¼¤ë¥÷
- ¤é´Á = Split(¤é´Á, ".") '¨ú±o¤é´Á
- If Not IsError(Application.Match(.Cells(4, i), ¤é´Á, 0)) Then '´M§ä¤é´Á
- ¥X¶Ô = E
- Exit For
- End If
- Next
- If ¥X¶Ô <> "" Then '¹w¨¾¨S¦³ [¥þ¤é,¦,±ß]ªº¯Z§O
- Set ¤é´Á = .Cells(4, i)
- Print_x = IIf(Print_x = 4, 1, Print_x + 1)
- With ¥X¶Ô³æ.Offset((Print_x - 1) * 14) '²Ä Print_x ªº¦ì¸m
- .Range("A1") = Rng(2).Offset(, 1) 'ªÀû¤¤¤å
- .Range("C1") = Rng(2).Offset(, 2) 'ªÀû½s¸¹
- .Cells(3, 0) = DateSerial(2013, 11, ¤é´Á) '¤é´Á
- .Range("A3") = ¥X¶Ô '®É¶¡
- .Range("C3") = IIf(¤é´Á.Offset(1) = "¤»", "(¬P´Á¤»)", "(¬P´Á¤é)") & "¨FÀsÀç·~"
- End With
- If Print_x = 4 Then 'º¡4µ§¦L¦C
- ¥X¶Ô³æ.Parent.PrintOut '¦L¦C¥X¶Ô³æ
- For ii = 0 To 3
- ¥X¶Ô³æ.Offset(ii * 14) = "" '²MªÅ¤w¦L¦C¸ê®Æ
- Next
- End If
- End If
- End If
- i = i + 1
- Loop
- End If
- Rng(1).Offset(, 1) = IIf(Rng(3) Is Nothing, "½ÐÀˬd : °²¤é¥X¶Ô³æ , ¹ï·Óªí §ä¤£¨ì ", "")
- End With
- Set Rng(1) = Rng(1).Offset(1) '¤U¤@¦ì©m¦W
- Loop
- If Print_x > 0 And Print_x <= 3 Then ¥X¶Ô³æ.Parent.PrintOut 1, Application.Round(Print_x / 2, 0) ' ¥¼º¡ 4 µ§ªº¸ê®Æ¨S¦L¦C
- End Sub
½Æ»s¥N½X |
|