- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
[µ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 |
|