- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 13
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-10-25
|
¦U¦ì«e½ú¦n
½Ð°Ý³o¬q»yªk ¬õ¦r³¡¥÷þÃ伶¼g¿ù»~ ¥L¤@ª½¥X²{«¬ºA¤£²Å©M
¬õ¦r³¡¥÷ §Ún¼g¤Jªº±ø¥ó¦¡¬O ...
alex520188 µoªí©ó 2014-11-19 10:51
¬õ¦r¬O«ü For Each current In Worksheets ³o¤@¦æ¶Ü?
§Ú°õ¦æ°_¨Ó¨S°ÝÃD³á.- Sub ¿ûµ¬p()
-
- Dim I%, J%, k% '«Å§iÅܼÆ
- Dim current As Worksheet
- For Each current In Worksheets '¹ï©Ò¦³¬¡¶Ã¯§@³B²z
- current.Select
- J = 1
- Do While Cells(1, J) <> "¶q´úÈ" 'º¡¨¬±ø¥ó®É°õ¦æ¥H¤U°Ê§@
- J = J + 1
- Loop
- J = J - 1
- Columns(J).Insert Shift:=xlToRight '¦V¥k´¡¤J¤@Äæ
- k = Range("a:a").End(xlDown).Row '¨ú±oAÄæ³Ì«á¤@®æ¦³¸ê®ÆªºÈ
- Range(Columns(J + 1).Rows(2), Columns(J + 2).Rows(k)).Clear 'Äæ¦ì¼ÆȲM°£
- Cells(1, J) = Now() 'Áä¤J®É¶¡
- For I = 2 To k Step 1
- If Cells(I, (J - 1)) - Cells(I, (J - 2)) > 0 Then
- Randomize 'Y¬Û´î¤j©ó0 ¶]t¶Ã¼Æ
- Cells(I, J) = Round(((-1 - -3) * Rnd + -3), 1) + Cells(I, (J - 1))
- ElseIf Cells(I, (J - 1)) - Cells(I, (J - 2)) < 0 Then
- Randomize 'Y¬Û´î¤p©ó0 ¶]¥¿¶Ã¼Æ
- Cells(I, J) = Round(((2 - 1) * Rnd + 1), 1) + Cells(I, (J - 1))
- Else
- Cells(I, J) = "" '¥H¤W±ø¥ó¤£¦¨¥ß«h¬°ªÅ¦r¦ê
- End If
- If Cells(I, J) - Cells(I, (J - 2)) = 0 Then
- 'Call µ¥©ó0
- End If
- With Cells(I, J + 1) '¨D±o¨âªÌ®t²§
- .Formula = "=IF(ISBLANK(" & .Offset(0, -1).Address & "),""""," & .Offset(0, -1).Address & " - " & .Offset(0, -2).Address & ")"
- With Cells(I, J + 2) '¨D±o¶q´úÈ
- '.Formula = "=IF(ISBLANK(" & .Offset(0, -2).Address & "),""""," & "c" & I & "+(Round(" & .Offset(0, -2).Address & [color=Red]" / " & .Offset(0, ".End(xlleft)+2).Address,0) ")[/color]
- End With
- End With
- If Cells(I, J) = "" Then '·í¦¹¬°ªÅ¦r
- Cells(I, J + 1) = "" '«hÅã¥ÜªÅ¦r¦ê
- Cells(I, J + 2) = ""
- End If
- Next I
- Set current = Nothing 'ÄÀ©ñª«¥óÅܼÆ
- Next current
- MsgBox "Worksheets working Success!!" '°T®§´£¥Ü
- End Sub
½Æ»s¥N½X |
|