Sub Colorea() ActiveSheet.Range("A1").Select Do If ActiveCell.Value = "" Then Exit Do Selection.EntireRow.Interior.ColorIndex = 15 Selection.Offset(1).Select Loop End Sub Sub Colorea() ActiveSheet.Range("A1").Select Do While ActiveCell.Value <> "" Selection.EntireRow.Interior.ColorIndex = 15 Selection.Offset(1).Select Loop End Sub Sub Colorea() ActiveSheet.Range("A1").Select Do Selection.EntireRow.Interior.ColorIndex = 15 Selection.Offset(1).Select Loop While ActiveCell.Value <> "" End Sub Sub Colorea() ActiveSheet.Range("A1").Select Do Selection.EntireRow.Interior.ColorIndex = 15 Selection.Offset(1).Select Loop Until ActiveCell.Value = "" End Sub Sub Colorea() ActiveSheet.Range("A1").Select Do Until ActiveCell.Value = "" Selection.EntireRow.Interior.ColorIndex = 15 Selection.Offset(1).Select Loop End Sub For comptador = principi To fi [ Step increment ] [instruccions] [Exit For] [instruccions] Next [comptador] For i = 1 to 50 For i = 50 to 1 Sub For_Next ( ) Dim i As Integer 'Estableix 10 repeticions , amb increment negatiu de 2 For i = 10 To 1 Step -2 Cells (i , 1) = i Next i End Sub Sub For_Next ( ) Dim i As Integer ' Estableix 10 repeticions , amb increment negatiu d'1 For i = 10 To 1 Step -1 Cells (i , 1) = i Next i End Sub Sub For_Next ( ) Dim i As Integer ' Estableix 10 repeticions . For i = 1 To 10 If Cells (i , 1 ) <> " " Then Cells (i , 1) = X Next i End Sub For I = 1 To 10 For J = 1 To 10 For K = 1 To 10 ... Next K Next J Next I If Then else If Then ElseIf Else End If Then Else Sub If_Then ( ) If [ A1 ] > 15 Then Msgbox "La cel · la A1 > 15 " End Sub Sub If_Then ( ) If [ A1 ] > 15 Then Msgbox "La cel · la A1 > 15" Else MsgBox "La cel · la A1 < 15 " End Sub Sub If_Then ( ) If [ A1 ] > 15 Then Msgbox "La cel · la A1 > 15 " If [ A1 ] < 15 Then MsgBox "La cel · la A1 < 15 " End Sub Select Case Case Else End Select Sub Select_Case ( ) Dim Nombre As Variant ' la declarem com Variant per evitar l'error de compilació que Obtindríem en el cas que [ A1 ] fora text Nombre = [ A1 ] ' Inicialitza variable . Select Case Nombre ' Avalua Nombre . Case 1 To 5: MsgBox " Entre 1 i 5 " ' Per N º s entre 1 i 5, inclusivament Case 6, 7 , 8: MsgBox " Entre 6 i 8" ' Per N º s entre 1 i 5, inclusivament Casi 9 To 10: MsgBox " Major que 8" ' Per N º s entre 9 i 10, inclusivament Case Else ' Per a altres valors . MsgBox " No està entre 1 i 10" End Select End Sub