Acties:
  • 0 Henk 'm!

  • sn33ky
  • Registratie: Juni 2004
  • Laatst online: 19:58
Ik ben op zoek hoe ik meerdere rijen in Excel kan toevoegen door middel van een Macro.

Ik heb nu meerdere 500+ rijen met gegevens en onder iedere rij wil ik 4 rijen toevoegen met onderstaande tekst:
- Hfd communicatie
- Hfd mobiliteit
- Schepen communicatie
- Schepen mobiliteit

Acties:
  • 0 Henk 'm!

Anoniem: 586752

Als je bestaande gegevens beginnen in A2 van "Blad1" kun je deze macro gebruiken:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Sub macro1()
Dim x As Integer, y as integer
With Sheets("Blad1")
x = .Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False
Do While x > 1
For y = 1 To 4
.Rows(x + y).Insert
.Cells(x + y, 1).Value = Application.Choose(y, "- Hfd communicatie", "- Hfd mobiliteit", "- Schepen communicatie", "- Schepen mobiliteit")
Next y
x = x - 1
Loop
Application.ScreenUpdating = True
.Columns(1).AutoFit
End With
End Sub

Acties:
  • 0 Henk 'm!

Anoniem: 586752

Geen reactie van de vragensteller, vreemd...