- ©«¤l
- 216
- ¥DÃD
- 71
- ºëµØ
- 0
- ¿n¤À
- 292
- ÂI¦W
- 0
- §@·~¨t²Î
- window xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2012-6-27
- ³Ì«áµn¿ý
- 2024-9-28
|
¦^´_ 16# c_c_lai
±z¦n, §Ú¥Î¤F¤Uzµ{§Ç³£¿W¥ßÀx¦sA123, B456¬O¨S¦³°ÝÃDªº.
¦ý¦]¬°§Ú¦bPASSWORD SHEET¤º¥[¤F¨Ç¸ê®Æ, ÅýA123, B456¥HVLOOKUP¨ú¸ê®Æ, ¤£ª¾¬O§_³oì¦], ·s¶}ªºA123ÀɮפÎB456Àɮפº, VLOOKUPªº¸ê®Æ³£Åܦ¨¤Fµ²#VALUE. ¦³¤èªk¸Ñ¨M¶Ü?
Sub Ex2() ' Hsieh & GBKEE
Dim f$, fd$, fs$, A As Range, Wb As Workbook
Set Wb = ThisWorkbook ' ¬¡¶Ã¯ :µ{¦¡½X©Ò¦bªº
fd = Wb.Path & "\" ' ¦sÀɪº¸ô®|
With Wb.Sheets("PASSWORD")
For Each A In .Range(.[A2], .[A2].End(xlDown))
' A : "A123" : Range/Range
' A : "B456" : Range/Range
' Sheets("PASSWORD").[A1] : "A123" : Variant/Object/Range
' Sheets("PASSWORD").[A1].End(xlDown) : "B456" : Variant/Object/Range
f = CStr(A)
fs = fd & f & ".xls"
Wb.Sheets(f).Copy ' «ü©w¬Oþ¤@Ó¬¡¶Ã¯ªº¤u§@ªín½Æ»s
' Sheets(f).Copy °õ¦æ¹L«á¡A½Æ»s¤F¤@¬¡¶Ã¯¡A¤º¦³¤@¦W¬° "A123" ¤§¤u§@ªí³æ¡C
' ActiveWorkbook.Name : "¬¡¶Ã¯1" : String
' ActiveWorkbook.Sheets(1).Name : "A123" : Variant/String
' Sheets(f).Copy °õ¦æ¹L«á¡A½Æ»s¤F¤@¬¡¶Ã¯¡A¤º¦³¤@¦W¬° "B456" ¤§¤u§@ªí³æ¡C
' ActiveWorkbook.Name : "¬¡¶Ã¯2" : String
' ActiveWorkbook.Sheets(1).Name : "B456" : Variant/String
With ActiveWorkbook
.ActiveSheet.UsedRange = .ActiveSheet.UsedRange.Value
' FileFormat:=xlExcel8 Excel 2003ª©¥» 56; xlExcel12 version 12, or 14, or 15 = Excel 2007, or 2010, or 2013.
.SaveAs Filename:=fs, Password:=CStr(A.Offset(, 1)), WriteResPassword:="", FileFormat:=xlExcel8
.Close 0 ' Ãö³¬ "D:\A123.xls" ¬¡¶Ã¯¡B"D:\B456.xls" ¬¡¶Ã¯¡C
End With ' ¥¿¦¡µ²§ô (Ãö³¬)¡C
Next
End With
End Sub |
|