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

[µo°Ý] ¥d¦í¤F--¦Û°Ê¤Æ°õ¦æ

[µo°Ý] ¥d¦í¤F--¦Û°Ê¤Æ°õ¦æ

¦U¦ì¤j¤j¡A³o´X¤Ñ¹J¨ì¤@­Óµ{¦¡µLªk±µ¤U¥h¶]ªº°ÝÃD¡A¸Õ¤F3,4¤ÑÁÙ¬OµLªk±µ¤U¥h¶](¦pªþ¥ó ¦Û°Ê¤Æ°õ¦æ.rar (37.22 KB) ¡AÁÂÁÂ*10~)PS:¸ô®|³]¦bD¼Ñ

¥Ø«e¦³¨â­Ó°ÝÃD(²ÊÅé¦rªí¥Ü):

¥´¶}Open ¬¡­¶Ã¯-->¦Û°Ê´N¥´¶}¤FP1¬¡­¶Ã¯-->°õ¦æP1¥¨¶°-->°õ¦æ§¹Copy¦^Open¬¡­¶Ã¯-->Ãö³¬P1¬¡­¶Ã¯-->¦Û°Ê´N¥´¶}¤FP2¬¡­¶Ã¯-->°õ¦æP2¥¨¶°-->°õ¦æ§¹Copy¦^Open¬¡­¶Ã¯-->Ãö³¬P2¬¡­¶Ã¯-->¦^¨ìOpen ¬¡­¶Ã¯¨ÃÅã¥ÜMsgBox "P1& P2 ¶]§¹ "

1) ¶}±ÒOpen ¦Û°Ê°õ¦æ" openworksheet"
2)¶}±ÒP1¦Û°Ê°õ¦æ¥¨¶°"P1"   °ÝÃD1:"Ãö§¹P1 ¬¡­¶Ã¯«á¡A¨S°õ¦æ¤U­±¨º¤@¦æµ{¦¡"¡A°ÝÃD2: ¥Ø«eCopy µLªk¶K¨ì Open ¸ê®Æ§¨¡A
3)¦]¬°¤W­±¨º­Ó¨S°õ¦æ¡A©Ò¥H³oµ{¦¡´N¨S±µ¤U¥h¶]¤F

VBA µ{¦¡¹ï·Ó¦p¤U:
-------------------------
1)
Sub openworksheet()

Workbooks.Open Filename:="D:\¦Û°Ê¤Æ°õ¦æ\P1.xlsm"

End Sub

Sub P1e()

Workbooks("Open").Activate
Workbooks("P1").Close False

'°ÝÃD1: Ãö§¹P1 ¬¡­¶Ã¯«á¡A¨S°õ¦æ¤U­±¨º¤@¦æ
Workbooks.Open Filename:="D:\¦Û°Ê¤Æ°õ¦æ\P2.xlsm"


End Sub

Sub P2e()

Workbooks("Open").Activate
Workbooks("P2").Close False

MsgBox "P1& P2 ¶]§¹ "

End Sub
-------------------------------------------
2)
Sub P1()

Dim i As Integer

For i = 1 To 5
    Cells(i, 1).Value = Format(Now, "ss")
    Application.Wait (Now + TimeValue("00:00:01"))
Next i


Range("A:A").Copy

   
'°ÝÃD2:µLªk¶K¨ì Open
Windows("Open.xlsm").Activate
    Columns("A:A").Select
    ActiveSheet.Paste
    Range("A1").Select

Application.Run "Open.xlsm!P1e"

End Sub

-------------------------------------------
3)
Sub P2()

Dim i As Integer

For i = 1 To 5
    Cells(i, 1).Value = Format(Now, "ss")
    Application.Wait (Now + TimeValue("00:00:01"))
Next i


Range("A:A").Copy

    Windows("Open.xlsm").Activate
    Columns("B:B").Select
    ActiveSheet.Paste
    Range("A1").Select

Application.Run "Open.xlsm!P2e"

End Sub

¦^´_ 1# ui123
½Ð­×§ï¤@¤U
  1. Option Explicit
  2. Sub openworksheet()
  3.     Dim AR(), E As Variant
  4.     AR = Array("p1", "p2")
  5.     For Each E In AR
  6.         Workbooks.Open Filename:="D:\¦Û°Ê¤Æ°õ¦æ\" & E & ".xls"
  7.         ActiveWorkbook.Close False
  8.     Next
  9.     MsgBox Join(AR, ",") & " ¶]§¹"
  10. End Sub
½Æ»s¥N½X
  1. Option Explicit
  2. Sub P1()
  3.     Dim i As Integer
  4.     With ThisWorkbook.Sheets(1)
  5.         For i = 1 To 5
  6.             .Cells(i, 1).Value = Format(Now, "ss")
  7.             Application.Wait (Now + TimeValue("00:00:01"))
  8.         Next i
  9.         Workbooks("Open.xls").Sheets(1).Range("A:A").Value = .Range("A:A").Value
  10.     End With
  11.     Application.Run "Open.xlsm!P1e" '°õ¦æ¨ä¥L¬¡­¶Ã¯ªºµ{§Ç
  12.     '³oµ{§Ç¤¤°õ¦æ¨ä¥L¬¡­¶Ã¯ªºµ{§ÇP1e,µ{§ÇP1e¤¤µ{¦¡½XÃö³¬ "³o¬¡­¶Ã¯",µ¥©ó°±¤îVBAµ{¦¡ªº°õ¦æ,¤£·|¦AÄ~Äò¤U¥hP1eªºµ{¦¡½X
  13.     '«Øij¤£­n°õ¦æ³o  Application.Run
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

­è­èµ{¦¡½X¶K¤W¥hÁÙ¬O·|¥d¦bP1µ²§ô¡A¨S¦³¶]P2 ¡AÀ³¸Ó¬Oª©¤j«Øij¤£­n°õ¦æ³o  Application.Run
¤pªº¤£¤~¡Aµ{¦¡¸òµ{¦¡¶¡¤£ª¾¦p¦ó»Î±µ¡A©Ò¥HµLªk¦Û°Ê°õ¦æ¤U¥h¡A¦³¨ä¥¦¤è¦¡¥i¥H¨Ï¥Î¶Ü? ·PÁ±z~

TOP

¦^´_ 3# ui123
P1,P2ªºµ{¦¡½X ,¦³§ï¶Ü?
  1. Option Explicit
  2. Sub P1()  
  3.     Dim i As Integer
  4.     With ThisWorkbook.Sheets(1)
  5.         For i = 1 To 5
  6.             .Cells(i, 1).Value = Format(Now, "ss")
  7.             Application.Wait (Now + TimeValue("00:00:01"))
  8.         Next i
  9.         Workbooks("Open.xls").Sheets(1).Range("A:A").Value = .Range("A:A").Value
  10.     End WithEnd Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE

·PÁª©¤j¡A¥Ø«eµ{¦¡½X¦p¤U¡AP1§Ú·Q±µ¤U¥hP2 ¡A¦ý¥¢±Ñ

Sub P1()
    Dim i As Integer
    With ThisWorkbook.Sheets(1)
        For i = 1 To 5
            .Cells(i, 1).Value = Format(Now, "ss")
            Application.Wait (Now + TimeValue("00:00:01"))
        Next i
        Workbooks("Open.xlsm").Sheets(1).Range("A:A").Value = .Range("A:A").Value
    End With
    Application.Run "Open.xlsm!P1e" '<----¦³¸õ¨ì¤U­±ªºP1e °õ¦æ¡A¦ý¬OWorkbooks.Open Filename:="D:\¦Û°Ê¤Æ°õ¦æ\P2.xlsm"<----¨S¶]³o­Ó

End Sub

Sub P1e()

Workbooks("Open").Activate
Workbooks("P1").Close False '¥Ø«e´ú¸Õ¤£·QÀx¦s<----¦³Ãö°_¨Ó

Workbooks.Open Filename:="D:\¦Û°Ê¤Æ°õ¦æ\P2.xlsm"<----"""¨S¶]³o­Ó¡A´N¬O³o¤@­Ó¦a¤è¬Ò¤£¤U¥h"""

End Sub

TOP

¦^´_ 5# ui123
  1. Sub openworksheet()
½Æ»s¥N½X
¦³­×§ï¦¨2#ªºSub openworksheet()¶Ü?
P1(),P2()ªºµ{¦¡½X ,¦³­×§ï¦¨2#ªºP1,P2¶Ü?
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE

Ya~~~¦¨¥\¤FGBKEE ¤j¡A§Ú¬ÝÀ´¤F¡A¥i¥H¦Û°Ê¤Æ¤F

¤£­n°õ¦æ³o  Application.Run ---> is the key,I got it !!!<(_ _)> «Ü¶}¤ß

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD