xlsvbah11.1

Attribute VB_Name = "mod1Oefeningen"

Option Explicit

Sub Oefening1()

    Dim i As Integer
    
    Range("A1").Select
    
    For i = 1 To 10
        
        ActiveCell.Value = "Hello"
        ActiveCell.Offset(1, 0).Select
    
    Next i

End Sub

Sub Oefening2()

    Dim i As Integer
    
    Range("B1").Select
    
    Do
        
        ActiveCell.Value = "World"
        ActiveCell.Offset(1, 0).Select
    
    Loop Until IsEmpty(ActiveCell.Offset(0, -1))

End Sub

Sub Oefening3()

    Dim rngBereik As Range
    Dim rngCel As Range
    
    Set rngBereik = Range("A1").CurrentRegion
    
    For Each rngCel In rngBereik.Cells
        Debug.Print rngCel.Value
    Next rngCel

End Sub

Sub MacroTaal()

    Dim i As Integer
    Dim a, b
    
    Range("A1").Select
    
    a = Timer
    
    For i = 1 To 10000
        
        ActiveCell.Value = "Hello"
        ActiveCell.Offset(1, 0).Select
    
    Next i
    
    b = Timer
    
    MsgBox b - a

End Sub

Sub ProgrammeerTaal()

    Dim i As Integer
    Dim a, b
    
    Range("A1").Select
    
    a = Timer
    
    For i = 1 To 10000
    
        Cells(i, 1).Value = "Hello World"
    
    Next i

    b = Timer
    
    MsgBox b - a

End Sub


Download hier het bestand.