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

[µo°Ý] range(cells(),cells())²£¥Í1004¿ù»~

[µo°Ý] range(cells(),cells())²£¥Í1004¿ù»~

§Ú¦³¤T­ÓexcelÀÉ¡A¦b²Ä¤@­Ó¤¤¼gµ{¦¡¦p¤U¡A¥i¥H°õ¦æ
A¥´¶}B§ä°Ï°ì³Ì¤j­È«á¡A¶K¦^A¤¤¡AÃö³¬«á¡A¦A¥´¶}C°Ï°ì³Ì¤j­È«á¡A¶K¦^A¤¤¡AÃö³¬«á¡Aµ²³tµ{¦¡
²Ä¤G­Ó«o»¡1004¿ù»~

¤@­Ó¥Îrange¨Ó³]©w°Ï°ì¨S¦³°ÝÃD¡A¥t¤@­Ó§ï¦¨range(cells(),cells())ªº¤è¦¡«o²£¥Í¿ù»~¡I½Ð°ª¤â«üÂI°g¬z

Sub ¥¿½T¥i°õ¦æ()
        Workbooks(1).Worksheets("test").Activate
        For i = 3 To 5
            sname = Workbooks(1).Worksheets("test").Cells(i, 1)
            Workbooks.Open Filename:=ThisWorkbook.Path & "\" & sname & ".xlsx"

               If Application.Sum(Workbooks(2).Worksheets("cr").Range("b2:b5")) > 0 Then
               Workbooks(1).Worksheets("test").Cells(i, 5) = Application.Sum(Workbooks(2).Worksheets("cr").Range("b2:b5"))
             End If

            Workbooks(2).Close
        Next
   
End Sub




Sub ¿ù»~¤£¥i°õ¦æ()
        Workbooks(1).Worksheets("test").Activate
        For i = 3 To 5
            sname = Workbooks(1).Worksheets("test").Cells(i, 1)
            Workbooks.Open Filename:=ThisWorkbook.Path & "\" & sname & ".xlsx"
                If Application.Sum(Workbooks(2).Worksheets("cr").Range(Cells(11, 2), Cells(11, 5))) > 0 Then
                Workbooks(1).Worksheets("test").Cells(i, 5) = Application.Sum(Workbooks(2).Worksheets("cr").Range(Cells(11, 2), Cells(11, 5)))
                End If
            Workbooks(2).Close
        Next
   
End Sub

¦^´_ 1# joey0415
  1. Sub ¿ù»~¤£¥i°õ¦æ()
  2.     Dim I As Integer, Sh As Worksheet, S As Long
  3.     Workbooks(1).Worksheets("test").Activate  'ActiveSheet(§@¥Î¤¤ªº¤u§@ªí)
  4.     'Cells(11, 2) ¬O³oWorksheets("test")ªº©Ò·|¦³¿ù»~
  5.     For I = 3 To 5
  6.         sname = Workbooks(1).Worksheets("test").Cells(I, 1)
  7.         Workbooks.Open Filename:=ThisWorkbook.Path & "\" & sname & ".xlsx"
  8.         Set Sh = Workbooks(2).Worksheets("cr")   '
  9.         S = Application.Sum(Sh.Range(Sh.Cells(11, 2), Sh.Cells(11, 5)))
  10.         '¤£¬O ActiveSheet(§@¥Î¤¤ªº¤u§@ªí) ªºRange,Cells(ª«¥ó) ­n«ü¦W¤÷¼h
  11.         
  12.         If S > 0 Then Workbooks(1).Worksheets("test").Cells(I, 5) = S
  13.         Workbooks(2).Close
  14.     Next
  15.    
  16. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

·PÁ¶Wª©¡I§Úµ¥¤@¤U¨Ó¸Õ¸Õ¬Ý®@¡I

¦A¦¸·PÁÂ

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD