- ©«¤l
- 11
- ¥DÃD
- 4
- ºëµØ
- 0
- ¿n¤À
- 21
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office2011
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-5
- ³Ì«áµn¿ý
- 2015-6-27
|
[µo°Ý] ½Ð±Ð¤ÀÄæ±Æ¦C:¦³µL§ó§Öªº¼gªk
·Q½Ð°Ý¦U¦ì¦p¦óÅý¤U±ªº¥¨¶°¶]±o§ó§Ö(²Ä¤GÓ³¡¤À)
°²³]§Ú¦bAÄæ,BÄæ¦U¦³50000¦C¦ÛµM¼Æ,
CÄæ=AÄæ+BÄæ,
DÄæ=ºØÃþ
CÄæ§Ú¹Á¸Õ¤F¤U±¤TºØ¼gªk
¤À§O¬O:
1.ª½±µ¥Îcell¬Û¥[
2.¥Î¤u§@ªí¨ç¼Æ
3.¥Î¦r¨å
¤èªk1¯Ó¶O2¬í
¤èªk2¯Ó¶O3¬í,
¥Î¦r¨å«h¬O0¬í
²@µLºÃ°Ýªº¥Î¦r¨å³Ì§Ö
¥N½X¦p¤U- Public Sub ¨âÄæ¬Û¥[1()
- Start = Timer 'p®É¶}©l
- With ActiveSheet
- For i = 1 To 50000
- .Cells(i, 3) = .Cells(i, 1) + .Cells(i, 2)
- Next
- End With
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô
- ===================
- Public Sub ¨âÄæ¬Û¥[2()
- Start = Timer 'p®É¶}©l
- With ActiveSheet
- For i = 1 To 50000
- .Cells(i, 3) = Application.WorksheetFunction.Sum(.Cells(i, 1), .Cells(i, 2))
- Next
- End With
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô Sub
- End Sub
- ===============
- Public Sub ¨âÄæ¬Û¥[3()
- Start = Timer 'p®É¶}©l
- Dim d As Object
- Set d = CreateObject("Scripting.Dictionary")
- With ActiveSheet
- For i = 1 To 50000
- d(i) = Cells(i, 1) + Cells(i, 2)
- Next
- Range("C1:C50000") = Application.Transpose(d.items)
- End With
- Set d = Nothing
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô Sub
- End Sub
½Æ»s¥N½X ======================
¤Á¤J¥¿ÃD:
DÄæ¬OºØÃþ,§Ú·QnÅýCÄ檺Ȩ̷ӦUºØÃþ±Æ¦b¹ïÀ³ªºÄæ
Ä´¦p²Ä1,3¦C¬OºØÃþA,²Ä2,5¦C¬OºØÃþB,²Ä4¦C¬OºØÃþC
§Ú¥ý¥Î¦r¨å²¾°£«½Æ«á,¦b²Ä50001¦CªºE,F,GÄæ¦C¥X¤TÓºØÃþ
µM«á¨C¤@¦C´N·|¨Ì·Ó50001¦C¦C¥Xªº¼Æ¦r,§âCÄ檺Ȩ̺ØÃþ±Æ¦b¸ÓÄæ
Ãþ¦ü¼Ï¯Ã¤ÀªR¨º¼Ë
§ÚªººÃ°Ý¬O,µL½×§Ú¦p¦ó¹Á¸Õ,´N¬O°µ¤£¥XAÄæ+BÄ樺ºØ³t«×(0¬í)
¤@¼Ë³£¬O50000¦C,¥Ø«e³t«×¶È¯à¹F3¬í
1.¥Îloop+ifŪ¥X¨C¦C¹ïÀ³ªºÄ渹
2.¥Î¦r¨å§â¨C¤@¦CÀ³¦bþ¤@ÄæŪ¶i¥h,¦AŪ¥X¨Ó
3.¦P2,¤£¹LŪ¥X¨Óªº¤è¦¡´«¦¨offset
µ²ªG¬O¤èªk2=3,ªá¶O3¬í,¤èªk1ªá¶O6¬í
§Ú¤£À´ªº¦a¤è¬O¬°¤°»ò¥Î¦r¨å¬Û¥[50000¦C¥i¥H0¬í¹F¦¨
¦ý¬O¤ÀÄæ±Æ§Ç50000¦C´N·|¯Ó®É¸û¤[
¦³¤H¥i¥H«üÂI°g¬z¶Ü
ÁÂÁÂ
======================- Public Sub ¤ÀÄæ´ú¸Õ1()
- Start = Timer 'p®É¶}©l
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With ActiveSheet
- arr1 = .Range("D1:D50000") '§Q¥Î¦r¨å¯S©Ê²¾°£«½Æ
- For i = 1 To 50000
- d(arr1(i, 1)) = 1
- Next
-
- For i = 1 To 6
- .Range("E50001").Resize(1, d.Count) = d.keys '©ó²Ä50001¦C¦C¥X©Ò¦³ºØÃþ
- Next
-
- For i = 1 To 50000
- For j = 1 To 6
- If .Cells(i, 4) = .Cells(50001, 4 + j) Then
- k = j + 4 'Ū¥X¨C¦CÀ³¸ÓÂ\¦bþ¤@Äæ
- End If
- Next j
- .Cells(i, k) = .Cells(i, 3) '¨Ì§Ç«öÄ渹¦C¥X¹ïÀ³È
- Next i
-
- Set d = Nothing
- Set arr1 = Nothing
- End With
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô
-
- End Sub
- ======================
- Public Sub ¤ÀÄæ´ú¸Õ2()
- Start = Timer 'p®É¶}©l
- Dim d1 As Object
- Dim d2 As Object
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- With ActiveSheet
- arr1 = .Range("D1:D50000") '§Q¥Î¦r¨å¯S©Ê²¾°£«½Æ
- For i = 1 To 50000
- d1(arr1(i, 1)) = 1
- Next
-
- For i = 1 To 6
- .Range("E50001").Resize(1, d1.Count) = d1.keys '©ó²Ä50001¦C¦C¥X©Ò¦³ºØÃþ
- Next
-
- For i = 1 To 6
- d2(.Range(Chr(68 + i) & "50001").Value) = i + 4 'Ū¥X¨C¦CÀ³¸ÓÂ\¦bþ¤@Äæ
- Next
-
- For i = 1 To 50000
- .Cells(i, d2(.Range("D" & i).Value)) = .Cells(i, 3) '¨Ì§Ç«öÄ渹¦C¥X¹ïÀ³È
- Next i
-
- Set d1 = Nothing
- Set d2 = Nothing
- Set arr1 = Nothing
- End With
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô
-
- End Sub
- =================
- Public Sub ¤ÀÄæ´ú¸Õ3()
- Start = Timer 'p®É¶}©l
- Dim d1 As Object
- Dim d2 As Object
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- With ActiveSheet
- arr1 = .Range("D1:D50000") '§Q¥Î¦r¨å¯S©Ê²¾°£«½Æ
- For i = 1 To 50000
- d1(arr1(i, 1)) = 1
- Next
-
- For i = 1 To 6
- .Range("E50001").Resize(1, d1.Count) = d1.keys '©ó²Ä50001¦C¦C¥X©Ò¦³ºØÃþ
- Next
-
- For i = 1 To 6
- d2(.Range(Chr(68 + i) & "50001").Value) = i + 1 'Ū¥X¨C¦CÀ³¸ÓÂ\¦bþ¤@Äæ
- Next
-
- For i = 1 To 50000
- .Cells(i, 3).Offset(0, d2(.Range("D" & i).Value)) = .Cells(i, 3) '¨Ì§Ç«öÄ渹¦C¥X¹ïÀ³È
- Next i
-
- Set d1 = Nothing
- Set d2 = Nothing
- Set arr1 = Nothing
- End With
- MsgBox "Completion in " & Format((Timer - Start) / 86400, "hh:mm:ss") 'p®Éµ²§ô
-
- End Sub
½Æ»s¥N½X ==========================
ªþ¥ó¤@ª½¶Ç¤£¤W¥h..
§Ú©ñ¦b§Úªºftp...
http://iamjo.myweb.hinet.net/¤ÀÄæ±Æ¦C.xls |
|