Belleke
Well-Known Member
I have a sheet called weekplanning and 5 sheets with the (working) days.
In weekplanning
Data for MO is in column b
TU in column c
We in column D
TH in column E
Fr in column F
These data has to go the daysheets, all starting in B4
I think that this code could be shorter, but I don't see it.
any idee?
In weekplanning
Data for MO is in column b
TU in column c
We in column D
TH in column E
Fr in column F
These data has to go the daysheets, all starting in B4
I think that this code could be shorter, but I don't see it.
Code:
Sub Weekplanning()
For Each ws In ThisWorkbook.Sheets
If ws.Name <> "Weekplanning" Then
ws.Range("B4:B28").ClearContents
End If
Next ws
sRij1 = 4
sRij2 = 4
sRij3 = 4
sRij4 = 4
sRij5 = 4
For Each c In Range("B4:B28").SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And c <> "Pauze" Then
Sheets("Maandag").Cells(sRij1, "B").Value = c.Value
sRij1 = sRij1 + 1
End If
Next
For Each c In Range("C4:C28").SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And c <> "Pauze" Then
Sheets("Dinsdag").Cells(sRij2, "B").Value = c.Value
sRij2 = sRij2 + 1
End If
Next
For Each c In Range("D4:D28").SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And c <> "Pauze" Then
Sheets("Woensdag").Cells(sRij3, "B").Value = c.Value
sRij3 = sRij3 + 1
End If
Next
For Each c In Range("E4:E28").SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And c <> "Pauze" Then
Sheets("Donderdag").Cells(sRij4, "B").Value = c.Value
sRij4 = sRij4 + 1
End If
Next
For Each c In Range("F4:F28").SpecialCells(xlCellTypeVisible)
If Len(c) <> 0 And c <> "Pauze" Then
Sheets("Vrijdag").Cells(sRij5, "B").Value = c.Value
sRij5 = sRij5 + 1
End If
Next
End Sub