- ©«¤l
- 559
- ¥DÃD
- 58
- ºëµØ
- 0
- ¿n¤À
- 626
- ÂI¦W
- 0
- §@·~¨t²Î
- win8
- ³nÅ骩¥»
- office2013
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- TW
- µù¥U®É¶¡
- 2010-11-22
- ³Ì«áµn¿ý
- 2024-6-14
|
¥»©«³Ì«á¥Ñ hugh0620 ©ó 2014-12-22 09:45 ½s¿è
¦^´_ 5# K_Wing
1. ±Nªºµ{¦¡½X¥þ³¡§R°£
2.±N¤U±ªºµ{¦¡½X¥þ³¡¶K¤W¡AÀ³¸Ó´N¬O§Anªºµ²ªG
§Ú¥Îªº¬O¤ñ¸ûª½±µÅÞ¿è©Êªº§PÂ_¨Ó§¹¦¨¡A©Ò¥H·|¤ñ¸ûªø¡A
¨S¤Ó¦h®É¶¡Â²¤Æµ{¦¡½X¡A¨ä¥L¤j¤jÀ³¸Ó¦³§ó²«Kªº¤è¦¡¡C- Sub ²£¥Í©â¼ú¦¸¼Æ()
- Dim A As Integer
- 'A = Range("B1") '©â¼ú¤H¼Æ
- 'Range("B2").ClearContents
- 'Range("A5:B65536").ClearContents '²M°£Âªº¦¸¼Æ
- A = Range("P6") '©â¼ú¤H¼Æ
- B = 20 '20¤H¤@±Æ
- C = A / B '¾ã¼Æ¦³¦h¤Ö±Æ(ex. C=100/20=5)
- If C = Int(C) Then
- D = C '·íC¬O¾ã¼Æªº®ÉÔ¡ADµ¥©óC´X±Æ¡A°j°én¶]ªº¦¸¼Æ
- Else
- D = Int(C) + 1 '·íC¤£¬O¾ã¼Æªº®ÉÔ¡ADµ¥©óC´X±Æ+1¡A°j°én¶]ªº¦¸¼Æ
- End If
- Range("A4").Select
- Range(Selection, Selection.End(xlToRight)).Select
- Range(Selection, Selection.End(xlDown)).ClearContents
- P = 1
- For J = 0 To D - 1
- Cells(4, J * 2 + 1) = "¤u¸¹(©m¦W)"
- Cells(4, J * 2 + 2) = "©â¤¤¸¹½X"
- For I = 1 To B '²£¥Í½s¸¹
- Cells(I + 4, J * 2 + 1) = P
- P = P + 1
- Next I
- Next J
- End Sub
- Sub ¤@¦¸©â¤@Ó½s¸¹()
- A = Range("P6") '©â¼ú¤H¼Æ
- B = 20 '20¤H¤@±Æ
- C = A / B '¾ã¼Æ¦³¦h¤Ö±Æ(ex. C=100/20=5)
- If C = Int(C) Then
- D = C '·íC¬O¾ã¼Æªº®ÉÔ¡ADµ¥©óC´X±Æ¡A°j°én¶]ªº¦¸¼Æ
- Else
- D = Int(C) + 1 '·íC¤£¬O¾ã¼Æªº®ÉÔ¡ADµ¥©óC´X±Æ+1¡A°j°én¶]ªº¦¸¼Æ
- End If
- '==== ½T©w¸¹½X¤£·|«½Æ==========
- 1
- K = Int(Round(Rnd(), 3) * 100)
- If K > A Then
- GoTo 1
- End If
-
- For J = 0 To D - 1
- For I = 1 To B '²£¥Í½s¸¹
- If K = Cells(I + 4, J * 2 + 2) Then
- GoTo 1
- End If
- Next I
- Next J
- '==== ½T©w¸¹½X¤£·|«½Æ==========
-
- P = Application.CountA(Range("B5:B24"), Range("D5:D24"), Range("F5:F24"), Range("H5:H24"), Range("J5:J24"))
- If P < 20 Then
- Range("K14") = K
- If P = 0 Then
- Cells(4, 2).Offset(1, 0) = K
- Else
- Cells(4, 2).End(xlDown).Offset(1, 0) = K
- End If
- ElseIf P >= 20 And P < 40 Then
- Range("K14") = K
- If P = 20 Then
- Cells(4, 4).Offset(1, 0) = K
- Else
- Cells(4, 4).End(xlDown).Offset(1, 0) = K
- End If
- ElseIf P >= 40 And P < 60 Then
- Range("K14") = K
- If P = 40 Then
- Cells(4, 6).Offset(1, 0) = K
- Else
- Cells(4, 6).End(xlDown).Offset(1, 0) = K
- End If
- ElseIf P >= 60 And P < 80 Then
- Range("K14") = K
- If P = 60 Then
- Cells(4, 8).Offset(1, 0) = K
- Else
- Cells(4, 8).End(xlDown).Offset(1, 0) = K
- End If
- ElseIf P >= 80 And P < 100 Then
- Range("K14") = K
- If P = 80 Then
- Cells(4, 10).Offset(1, 0) = K
- Else
- Cells(4, 10).End(xlDown).Offset(1, 0) = K
- End If
- ElseIf P >= 100 Then
- MsgBox "¤w§¹©â¼ú"
- GoTo 2
- End If
- 2
- End Sub
½Æ»s¥N½X |
|