Learning VBA

Sub the MyTest ()
 ' A column? Presentation column B 
    Dim I of As  Long 
    
    I = . 1 
    the While  True 
        the If I> 10  the Then  the GoTo ENDLOOP 
        
        Cells (I, . 1 ) = . 1 
        
        the If I Mod  2 = 0  the Then  the GoTo Nextloop1 
        Cells (I, 2 ) = I * I 
        
Nextloop1: 
    I = I + . 1 
    Wend 
    
ENDLOOP: 

' in column C, row D demonstrates 
    the For I = . 1  the to 10000
        If i > 10 Then Exit For '或 if i > 10 then exit sub
        
        Cells(i, 3) = i
        If i Mod 2 = 0 Then GoTo nextloop2 '中断当前循环
        Cells(i, 4) = i * i
        
nextloop2:
    Next
End Sub

 

Guess you like

Origin www.cnblogs.com/ckstock/p/11788308.html