- ©«¤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
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-8-1 12:26 ½s¿è
¦^´_ 26# happycoccolin
¥ý±N B_0731.xlsx "§Æ±æÅã¥Ü¦b³oÄæ¦ì" ¦r¼Ë§R±¼Àx¦sÃö³¬«á¡A¦A°õ¦æ¡C- Sub TEST()
- Const DATABASE_NAME = "A" '¸ê®Æ®w¤u§@ªí¦WºÙ
- Const DATABASE_COL = 5 'EÄæ
- Const COMPARE_COL = 11 'KÄæ
-
- Dim d, ar, filein, fileout, s, i As Long
-
- Set d = CreateObject("scripting.dictionary")
- ar = Sheets(DATABASE_NAME).[A1].CurrentRegion.Value
- For i = 2 To UBound(ar)
- d(Replace(ar(i, DATABASE_COL), "-", "")) = ar(i, 1)
- Next
-
- filein = Application.GetOpenFilename(Title:="¿ï¾Ün¤ñ¹ïªºÀÉ®×")
- If Not TypeName(filein) = "String" Then Exit Sub '¨ú®ø«hµ²§ô
-
- Application.ScreenUpdating = False
- With Workbooks.Open(filein)
- ar = .Sheets(1).[A1].CurrentRegion.Value
- .Close False
- End With
- Application.ScreenUpdating = True
-
- ReDim Preserve ar(LBound(ar) To UBound(ar), LBound(ar, 2) To UBound(ar, 2) + 1)
- For i = LBound(ar) + 1 To UBound(ar)
- s = Replace(ar(i, COMPARE_COL), "-", "")
- If d.exists(s) Then
- ar(i, UBound(ar, 2)) = d(s)
- Else
- ar(i, UBound(ar, 2)) = "No Data"
- End If
- Next
-
- fileout = Application.GetSaveAsFilename(Title:="¥t¦s¬°·sÀÉ")
- If Not TypeName(fileout) = "String" Then Exit Sub '¨ú®ø«hµ²§ô
-
- With Workbooks.Add.Sheets(1)
- .[A1].Resize(UBound(ar), UBound(ar, 2)).Value = ar
- .Parent.SaveAs fileout
- End With
- End Sub
½Æ»s¥N½X |
|