mariannevanh
Terugkerende gebruiker
- Lid geworden
- 14 dec 2004
- Berichten
- 2.133
Bij het uitvoeren van onderstaande (gedeeltelijk weergegeven) macro, krijg ik een foutmelding:
Compileerfout; Next zonder For
De macro:
Dim X, T
T = 2
For K = 4 To 202 'eerste cel van naam klanten
L = K / 2
If Cells(1, K) <> "" Then
Sheets("Blad2").Cells(1, L).Value = Sheets("Blad1").Cells(1, K).Value
For X = 4 To 100 'controleer rijen 4 t/m 100
Sheets("Blad1").Select
If Cells(X, 3) <> 0 Then
Sheets("Blad2").Select
Sheets("Blad2").Cells(T, 1).Value = Sheets("Blad1").Cells(X, 1).Value
Sheets("Blad2").Cells(T, 2).Value = Sheets("Blad1").Cells(X, 3).Value
T = T + 1
End If
Next X
Next K
Sheets("Blad2").Select
Range("A1").Select
Application.ScreenUpdating = True
Sheets("Blad1").Select
End Sub
Wie helpt?
Alvast bedankt,
Guido
Compileerfout; Next zonder For
De macro:
Dim X, T
T = 2
For K = 4 To 202 'eerste cel van naam klanten
L = K / 2
If Cells(1, K) <> "" Then
Sheets("Blad2").Cells(1, L).Value = Sheets("Blad1").Cells(1, K).Value
For X = 4 To 100 'controleer rijen 4 t/m 100
Sheets("Blad1").Select
If Cells(X, 3) <> 0 Then
Sheets("Blad2").Select
Sheets("Blad2").Cells(T, 1).Value = Sheets("Blad1").Cells(X, 1).Value
Sheets("Blad2").Cells(T, 2).Value = Sheets("Blad1").Cells(X, 3).Value
T = T + 1
End If
Next X
Next K
Sheets("Blad2").Select
Range("A1").Select
Application.ScreenUpdating = True
Sheets("Blad1").Select
End Sub
Wie helpt?
Alvast bedankt,
Guido