Sub T1 () Range ("d2") = Range ("b2") * Range ("C2") Range ("d3") = Range ("B3") * Range ("C3") Range ("d4") = Range ("b4") * Range ("C4") range ("d5") = Range ("b5") * Range ("C5") Range ("d6") = Range ("b6") * Range ("C6") End Sub
Sub T2 () Dim x as Integer For x = 10000 to 2 Step-3 Range ("D" & x) = Range ("B" & X) * Range ("C" & X) Next x End Sub
Sub t3 () Dim RG as Range//range represents a Cell object For each RG in Range ("D2:d18") RG = RG. Offset (0,-1) * RG. Offset (0,-2) Next RG End Sub
Sub t4 () Dim x as Integer x = 1 Do x = x + 1 cells (x, 4) = Cells (x, 2) * Cells (x, 3) Loop Until x = End Sub
Sub T5 () x = 1 Do and x < x = x + 1 cells (x, 4) = Cells (x, 2) * Cells (x, 3) Loop End Sub
|
Sub S1 () Dim RG as Range For each RG in Range ("A1:b7,d5:e9") If RG = "then" RG = 0 End If Next RG End Sub
Sub S2 () Dim x as Integer Do x = x + 1 If Cells (x + 1, 1) <> Cells (x, 1) + 1 Then Cells (x, 2) = "Breakpoint" Exit do//jump out Do loop End If Loop Until x = End Sub |
20160127: Start learning VBA: (iv), looping statements