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

[µo°Ý] §PÂ_³sÄò¼Æ¦r VBA CODE §ïµ½ ½Ð«ü±Ð

[µo°Ý] §PÂ_³sÄò¼Æ¦r VBA CODE §ïµ½ ½Ð«ü±Ð

§ÚªºEXCEL VBA  ¥D­n¥Î¨Ó§â 0-9 ªº³sÄò¼Æ¦r ¨ú¥X  

²{¦bªºVBA CODE ¤ñ¸û²ÖÂØ  0-9 ´N¤w¸g¨º»ò¦hCODE¤F  °²¦p0-50 ¨º¤£´N­n50­Ó±ø¥ó¤F?  
¦Û¤v¦³·Q¹L¥Îfor loop ¥h¶i¦æ¥[¼Æ¤è¦¡  ¦ý¤£¤Ó·| ¨D«ü±Ð

test.rar (92.63 KB)

§ÚªºEXCEL VBA  ¥D­n¥Î¨Ó§â 0-9 ªº³sÄò¼Æ¦r ¨ú¥X  

²{¦bªºVBA CODE ¤ñ¸û²ÖÂØ  0-9 ´N¤w¸g¨º»ò¦hCODE¤F   ...
adrian_9832 µoªí©ó 2019-3-1 21:11

¬Ý¤£À´§Aªº¨Ò¤l...
¬°¬Æ»ò¤@¶}©l 210280 »P 210281 ¤£ºâ³sÄò¼Æ¦r?
±µµÛ 21032 21033 21034 ¤]¤£ºâ³sÄò¼Æ¦r?
§A»Ý­n±Ô­zªº§ó²M·¡¤@ÂI,
­þ¨Ç±¡§Î¤U¤£¯à¦C¤J³sÄò¼Æ¦r³B²z³á.

­Y°²³]¥u­n¬O³sÄò¼Æ¦r³£¦C¥X¨Ó,
¨º»ò¥i¥H¥Î¤U¦¡:
  1. Sub nn()
  2.   Dim lRow&, lVal&
  3.   
  4.   lRow = 1
  5.   lVal = -99999
  6.   Do While Cells(lRow, 3) <> ""
  7.     With Cells(lRow, 3)
  8.       If .Value = lVal + 1 Then
  9.         .Interior.ColorIndex = 34
  10.         .Offset(, 2) = "abc"
  11.         If .Offset(-1, 2) <> "abc" Then
  12.         .Offset(-1).Interior.ColorIndex = 34
  13.         .Offset(-1, 2) = "abc"
  14.         End If
  15.       End If
  16.        lVal = .Value
  17.     End With
  18.     lRow = lRow + 1
  19.   Loop
  20. End Sub
½Æ»s¥N½X

TOP

¦]¬°°ÝÀY¨º­Ó 210280 »P 210281  ¥u¦³0¸ò1   ±ø¥ó¬O­n 0 ,1,2,3,4,5,6,7,8,9  ·í³£»ô ¤~²Å¦X±ø¥ó
¥u¬O·Q¾Ç²ß¤@¤U §O¤Hªºªk¤l¬O«ç¼Ë§Ë ÁÂÁ  
¥H¤U¬O§Úªº¤èªk

Sub TE123ST()
Columns("e:e").Select
Selection.ClearContents
x = 1
Do Until Cells(x, 3) = ""
currentcell = Cells(x, 3)

If Right(currentcell, 1) = "0" Then
For i = 1 To 9
     nextcell = Cells(x + i, 3)
    If Val(nextcell) <> Val(currentcell) + i Then
        Exit For
    End If
   
    If Val(nextcell) = Val(currentcell) + 9 Then
        Range(Cells(x, 5), Cells(x + 9, 5)).Value = "abc"
        Range(Cells(x, 3), Cells(x + 9, 3)).Select
        With Selection.Interior
           .Pattern = xlSolid
           If abc = 34 Then
                .PatternColorIndex = xlAutomatic
                .ColorIndex = 35
               abc = 35
               Else
               .ColorIndex = 34
               abc = 34
            End If
        End With
    End If
Next i
End If
x = x + 1
Loop

End Sub

TOP

¦^´_ 2# luhpro


    §Ú¸Õ¥Î§AªºCODE ¦ýERROR Åã¥Ü«¬ºA¤£²Å¦X

TOP

Sub Macro33()
Dim xR As Range, xH As Range, N%
[C:C].Interior.ColorIndex = 0
[E:E].ClearContents
For Each xR In Range([C1], [C65536].End(xlUp))
    If Right(xR, 1) = "0" Then Set xH = xR:  N = 0
    If xR - xH = N Then N = N + 1 Else N = 0
    If N = 10 Then
       With Range(xR, xH): .Interior.ColorIndex = 34: .Offset(, 2) = "abc": End With
    End If
Next
End Sub

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD