- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 15
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-12
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2013-6-23 21:08 ½s¿è
...
³æ¿W¥´¶} A.xlsm ©Î B.xlsm ®É,¥¨¶°³£«Ü¥¿±`
...
¦ý¦pªG¦bEXCEL¨Ã±ÆÅã¥Ü A.xlsm ©M B.xlsm
...
¤£¥Î´X¤ÀÄÁ
A.xlsm ©M B.xlsm ªºABÄæ³£¿z¿ï¤F(=.=)
...
¥ìÁɺ¸ µoªí©ó 2013-6-23 10:39
¨ä¹ê³o¬O Excel VBA µ{¦¡¥»¨¾÷¨î©Ò³y¦¨§@¥Î¹ï¶H«D¬°¹w´Áªºª¬ªp.
¤£½×§Aªº VBA µ{¦¡©ñ¦bþӰ϶ô(Sheet1¡BSheet2¡B,Module1...)
¥un§A¨S¯S·N¥h¹LÂoªº¸Ü,
¨Ï¥Î ActiveSheet ·|§@¥Î¦b "¦P¸s²Õ" ¤¤¥Ø«e¬O Active ªº Sheet,(¤]¥i¯à«D¦P¤@ÀɮשÎWorkbook) <--- ¤×¨ä¬O³oÓ .
** ¤W¤èªº "¦P¸s²Õ" ¬O«ü¦b¤U¤èSheet¶Ã±¤W«ö·Æ¹«¥kÁä,¿ï²¾°Ê©Î½Æ»s«á,¦b¿ï³æ¤¤¥i¥H¿ï¨ìªº¥ô¦óSheet)
©Ò¥H¦pªGµ{¦¡ÁÙ¦bI´º¹B§@,
³o®É¨Ï¥ÎªÌ¤â°Ê¥h¤Á´«¤FSheet«á(©Î¬O¤S¥t¶}¤F¤@Ó Excel ÀÉ®×),
´N¥i¯àµo¥Í«D¹w´Áªºµ²ªG.
§Ú¯à·Q¨ìªº¦³¨âºØ¤è¦¡¥i¥HÁ×¹L³oÃþ§@¥Î¹ï¶H¿ù»~ªº°ÝÃD:
1. ¦b Sub »P End Sub ¤¤¶¡¥ý¥]¤W If ActiveSheet.Name="Sheet1" Then »P End If ªº±Ôz,
¥H½T«Oµ{¦¡¤£·|§@¥Î¨ì¿ù»~ªº¼Ðªº¤W,
¤£¹L¦b¬Y¨Ç±¡§Î¤U¨ä¤ºªºµ{¦¡¤]¥i¯à®Ú¥»´N¤£·|°õ¦æ¤F.
2. ¦b Module ¤W¤è¥[¤W Public Sh As Worksheet ªº¦@¥Î«ü¼Ð«Å§i,
¦A©ó Workbook ªº Open ¤èªkµ{¦¡¤º¥[¤W,
Set sh = Sheets("sheet2") ¤§Ãþªº«ü¥O¨Ó«ü©wn§@¥ÎªºSheet¥Ø¼Ð,
¤§«á¤£ºÞ¦bþ¸Ì³£¥i¥H¥Î With sh »P End With ©Î¬O sh.[A1] ¤§Ãþªº«ü¥O¨Ó©w¦ºn§@¥Îªº Sheet.
·íµM, ²Ä 2 Ӥ覡§Úı±oÀ³¸Ó¤ñ¸û¦n¥Î¥B²Å¦X§Ú̹w´Áªº®ÄªG. |
|