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

±q¤@­ÓWorkbook§Û¼g¸ê®Æ¨ì¥t¤@­ÓWorkbook

±q¤@­ÓWorkbook§Û¼g¸ê®Æ¨ì¥t¤@­ÓWorkbook

¦³¨â­ÓWorkbook,ºÙ¤§¬°A©MB
¸ê®Æ¦bB
²{¦b¹Á¸Õ¦bAªºVBA¶}啓B,¹BºâBªºmacro,¦W¬°test
§Y
  1. workbooks.open thisworkbook.path & "\B.xls"
  2. application.run worbooks("'B.xls'!test")
½Æ»s¥N½X
¨ì³o¸Ì¨S¦³°ÝÃD
¦¨¥\¶}啓«á
Bªºvba§ä¥X¬ÛÃö¦ì¸m¤Î§Û¼g,¥Hrange A1¬°¨Ò
  1. sub test()
  2. with sheet1
  3. .range(.cells(1,1),.cells(1,1).end(xldown).end(xltoright).address).copy workbooks("A.xls").sheet1.range("A1")
  4. end sub
½Æ»s¥N½X
¦b³o¸Ì¥¦¥X²{¤Ferror 438 ª«¥ó¤£¤ä´©¦¹ÄݩʩΤèªk
¤£ª¾¨º¸Ì¿ù¤F
ÁÂÁ¦U¦ì¸Ñµª
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¦^´_ 1# FAlonso


¥ý°Ý¤@ÂIÂI¸ê®Æ,
¬°¦ó­n°õ¦æ B ªº vba ¤~§@§Û¼gªº°Ê§@,
¤£¥Ñ A ¤ºªº vba ¥þµ{°õ¦æ?

TOP

¦^´_ 1# FAlonso

A.xlsªºµ{¦¡½X
  1. Sub Run_B_macro()
  2. Workbooks.Open ThisWorkbook.Path & "\B.xls"
  3. Application.Run "B.xls!test"
  4. End Sub
½Æ»s¥N½X
B.xlsªºµ{¦¡½X
  1. Sub test()
  2. With Sheets(1)
  3. .Range(.Range(.Cells(1, 1), .Cells(1, 1).End(xlDown)), .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown)).End(xlToRight)).Copy Workbooks("A.xls").Sheets(1).Range("A1")
  4. End With
  5. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦ó¤£°®¯Ü¥Îusedrange
  1. Sub test()
  2. With Sheets(1)
  3. .UsedRange.Copy Workbooks("A.xls").Sheets(1).Range("A1")
  4. End With
  5. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤ß¤¤±`¦sµ½¸Ñ¡B¥]®e¡B·P«ä¡Bª¾¨¬¡B±¤ºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD