- ©«¤l
- 913
- ¥DÃD
- 150
- ºëµØ
- 0
- ¿n¤À
- 1089
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 2019
- ¾\ŪÅv
- 50
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2011-8-28
- ³Ì«áµn¿ý
- 2023-7-19
|
¦^´_ 18# oobird
¦Ñ¤j,¤£¦n·N«ä³o¬O¦^Âе¹§Aªº,§Ú«ö¿ù¼Ó¼h,§Ú·Q§AÀ³¸Ó¨S¦¬¨ì,§Ú±N«e2¦¸°µÓ¾ã²z.
1) §Ú¥ý¸Õ¤F§ì¨úFÄæfile nameªº¥¨¶°,µo²{¥¦¥u·|±N©Ò¦³ÀɦW§ì¶i¨Ó¦Ó¤£·|¤ñ¹ï.
2) §Ú¸ÕµÛ¦Û¤vkey§¹¾ãªºÀɦW¦bFÄæ,µM«á±N2012¦~ªºbcmÀɮשñ¦b"2012 PI_PO"¸ê®Æ§¨¤¤(¦]¬°¦~«×«Ü¦h,©Èrun¤Ó¤[),µM«áקïµ{¦¡¦p¤U,¦ý§¹¥þ¤£¯à°Ê§@!- Sub get_value()
- Dim a As Range, arr(1 To 5)
- Application.ScreenUpdating = False 'Ãö³¬¿Ã¹õ°{Ã{
- For Each a In Range([f2], [f2].End(4)) '¦bf2¥H¤Uªº¸ê®Æ½d³ò´`Àô
- If Application.CountA(Rows(a.Row)) = 1 Then 'a:eÄæ¤w¦³¼g¤J¸ê®Æ´N¸õ¹L
- Application.DisplayAlerts = False 'Ãö³¬¶}±Ò®Éªº¹ï¸Ü¤è¶ô
- fb = ThisWorkbook.Path & "\2012 PI_PO\" & a '±q"PI_PO¸ê®Æ§¨"¨ú¸ô®|
- Set wk = GetObject(fb) 'I´º¶}±Ò¸Ó¸ô®|ÀÉ®×
- Sh = Array("PI", "PO") '¨âÓ¤u§@ªí¦W
- On Error Resume Next '²¤¹L¿ù»~
- For s = 0 To 1
- Set mysheet = wk.Sheets(Sh(s)) '¤u§@ªíÅܶq
- If Err.Number = 0 Then '¦p¤£µo¥Í¿ù»~(¦³³oÓ¤u§@ªí)
- mysheet.AutoFilterMode = False '¨ú®ø¿z¿ï
- mysheet.[a:b].Replace "TOTAL:", "TOTAL", xlWhole '§â±a¤À¸¹ªºTOTAL§ï¦¨¤£±a¤À¸¹
- r = mysheet.[a:b].Find("TOTAL", , , 1, xlByRows).Row '¦bAB¨âÄæ´M§ä"TOTAL"
- c = mysheet.Cells(r, 15).End(1).Column '¨úTOTAL¨º¤@¦æªº³Ì¥kÄæ(§Yª÷ÃB)
- arr(1) = Split(a, " ")(0) '¨úfÄæ²Ä¤@ӪŮæ¥H«eªº¦r¦ê
- arr(s * 2 + 2) = mysheet.Cells(r, c - 3).Value '¨ú³Ì¥kÄæ´î3Ä檺¼Æ¦r
- arr(s * 2 + 3) = mysheet.Cells(r, c).Value '¨ú³Ì¥kÄ檺¼Æ¦r
- End If
- Err.Clear '²M°£¿ù»~
- Next
- Cells(a.Row, 1).Resize(1, 5) = arr '¼g¤JÀx¦s®æ
- Erase arr
- wk.Close 0 'Ãö³¬¥´¶}ªºÀɮפ£Àx¦s
- End If
- Next
- End Sub
½Æ»s¥N½X |
|