ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¸óÀɮרú±o¨ä¤¤¬Ysheet¤ºªº¬YÄæ¦ì­È¡AÀ³¸Ó¦p¦ó¨Ï¥ÎVBA¼¶¼g?

[µo°Ý] ¸óÀɮרú±o¨ä¤¤¬Ysheet¤ºªº¬YÄæ¦ì­È¡AÀ³¸Ó¦p¦ó¨Ï¥ÎVBA¼¶¼g?

¥Ø«e¦³¤@­Ó»Ý­n¸óÀɮרú±o³Ì·sÄæ¦ì­Èªº»Ý¨D¡A
¦Ó¥B­n¦b¤£¶}¥t¤@¥÷Àɮתºª¬ªp¤U¨ú±o³o­ÓÄæ¦ìªº­È¡A
¤£ª¾¹D¦³¨S¦³¤ñ¸û¦nªº¼gªk?

¥»©«³Ì«á¥Ñ mark15jill ©ó 2012-3-27 10:39 ½s¿è

¦^´_ 1# ashyaurora


    ª½±µÀx¦s®æ¥´
='¦ì¸m\[ÀɮצWºÙ]¬¡­¶Ã¯¦WºÙ'!$A$1


PS ·Ð½ÐªþÀÉ ¤j¬ù¬O­þºØ

TOP

¤§«e§Ú¦³°ÝÃDÃþ¦üªº°ÝÃD~
¦ý³£¬O¥´¶}Àɮ׫á~ ±N¸ê®Æ§ì¥X~ ¦AÃö±¼~
´£¨Ñ¤§«e¤j¤jµ¹§Úªº¤è¦¡~ µ¹§A°Ñ¦Ò~
http://forum.twbts.com/viewthread.php?tid=4725&highlight=
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

°²³]§A­nªº¸ê®Æ¦s©ó¬¡­¶Ã¯2(¨Ã¥¼¶}±Ò)¤¤¤u§@ªí1ªºA1
¦Ó§A­n§â³o¸ê®Æ©ñ¨ì¥Ø«e§@¥Î¤¤¤u§@ªíªºA1
Code ¦p¤U:
Cells(1, 1).Formula = "='[¬¡­¶Ã¯2.xlsx]¤u§@ªí1'!$A$1"         ' for Excel 2010
Alex

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-3-28 07:50 ½s¿è

¤]¥i¥H§Q¥Î©I¥sexcel ´£¨Ñªº XLM macro¨Ó¹F¦¨.
©³¤Uªº GetValue Function¦³¥|­Ó¤Þ¼Æ :
¡Epath: ¸ê®Æ©Ò¦bÀɮתº¸ô®| (e.g., "d:\Data\ or d:\Data")
¡Efile: ¬¡­¶Ã¯¦WºÙ (e.g., "Input.xls" or "Input.xlsx)
¡Esheet: ¤u§@ªí¦WºÙ (e.g., "Sheet1")
¡Eref: §A©Ò­nªº­È©Ò¦bÀx¦s®æªº¦ì§}°Ñ·Ó (e.g., "C5")

Private Function GetValue(path, file, sheet, ref)
'   ±q¤@­ÓÃö³¬ªº¬¡­¶Ã¯¤¤¨ú¸ê®Æ
    Dim arg As String
'   ½T©wÀɮצs¦b
    If Right(path, 1) <> "\" Then path = path & "\"
    If Dir(path & file) = "" Then
        GetValue = "File Not Found"
        Exit Function
    End If
'   ³]©w°õ¦æXLM Macroªº°Ñ¼Æ
    arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
'   °õ¦æMicrosoft Excel 4.0 ¥¨¶°
    GetValue = ExecuteExcel4Macro(arg)
End Function
Alex

TOP

½Ð°Ý¥i¥H´£¨Ñ¹ê»ÚªºÀɮ׶Ü,ÁÂÁÂ
¥]§tXLMÀÉ.¸ê®Æ¦s©ó¬¡­¶Ã¯2.¸ê®Æ©ñ¨ì¥Ø«e§@¥Î¤¤¤u§@ªíªºA1

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-3-29 07:32 ½s¿è

¦^´_ 6# VANESSA
ªþ¥ó¤¤¦³¨â­ÓÀÉ®×
¬¡­¶Ã¯2¬OÃö³¬¤¤(¶}±Ò¤¤ªº¤]workable)ªºÀÉ®×, §A©Ò­nªº¸ê®Æ°²³]¦b¨ä¤¤¤u§@ªí1ªº"D3"Àx¦s®æ
¬¡­¶Ã¯2½Ð§â¥¦©ñ¨ì C:\Users\user\Documents ¸ê®Æ§¨
³o­ÓÀɮשñ¨ì­þ¸Ì±N·|¼vÅT¨ìGetValue¨ç¼Æªº²Ä¤@­Ó¤Þ¼Æ
¬¡­¶Ã¯1ªº¤u§@ªí1¬O¥Ø«e§@¥Î¤¤ªº¤u§@ªí
©R¥O«ö¶sªº¤u§@«Ü³æ¯Â
´N¬O¥h°õ¦æ  Cells(1, 1).Value = GetValue("C:\Users\user\Documents", "¬¡­¶Ã¯2.xlsx", "¤u§@ªí1", "D3")
¬¡­¶Ã¯1.zip (25.87 KB)
Alex

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-3-29 08:32 ½s¿è

¦^´_ 6# VANESSA


    ³o¼Ë²³æ½d¨ÒÀ³¸Ó¤ñ¸û®e©öª¾¹D¦p¦ó¨Ï¥Î
A1¤½¦¡
='D:\[Book2.xls]Sheet1'!A1
A2¬O°õ¦æ¥¨¶°nnªºµ²ªG¡AA2¬O±o¨ìBook2ªºSheet1¤u§@ªíA1ªº­È
  1. Sub nn()
  2. [A2] = ExecuteExcel4Macro("'D:\[Book2.xls]Sheet1'!R1C1")  '¨Ï¥Î4.0¥¨¶°¨ú­È¡A¥²¶·¨Ï¥ÎR1C1§Î¦¡°Ñ·Ó
  3. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¸Õ¦¨¥\,¦ý¬O¦pªG§Ú·Q¦A§ó¶i¶¥
¦b¬¡­¶Ã¯1¿ï"201"´N·|¥X²{¬¡­¶Ã¯2ªº201¸ê®Æ
¦b¬¡­¶Ã¯1¿ï"202"´N alsdream.zip (23.34 KB) ·|¥X²{¬¡­¶Ã¯2ªº202¸ê®Æ (¦¹®É¬¡Ã¯2ªº¸ê®Æ¤]·|§ï)

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD