Delftsblauw
New Member
- Joined
- Jul 9, 2014
- Messages
- 4
Hi,
I'm a new member, but in the last year i always checked for solutions in this forum. But now i'm stuck with shorting some code i made.
Is there a solution for shorting this code
I hope you can help me out.
Thanx
Delftsblauw
I'm a new member, but in the last year i always checked for solutions in this forum. But now i'm stuck with shorting some code i made.
Is there a solution for shorting this code
Code:
Sub Januari1()
Dim Medewerker, Maand As String
Medewerker = Verlof.ComboBox1.Value
Maand = "Januari"
Dim result As String
result = Application.WorksheetFunction.VLookup(Medewerker, Sheets(Maand).Range("A:DV"), 126, False)
If Sheets("Temp").Range("C1") = 1 And Sheets("Temp").Range("B1") = 1 Then Sheets(Maand).Range("B" & result & ":E" & result) = "x"
If Sheets("Temp").Range("C2") = 1 And Sheets("Temp").Range("B2") = 2 Then Sheets(Maand).Range("F" & result & ":I" & result) = "x"
If Sheets("Temp").Range("C3") = 1 And Sheets("Temp").Range("B3") = 3 Then Sheets(Maand).Range("J" & result & ":M" & result) = "x"
If Sheets("Temp").Range("C4") = 1 And Sheets("Temp").Range("B4") = 4 Then Sheets(Maand).Range("N" & result & ":Q" & result) = "x"
If Sheets("Temp").Range("C5") = 1 And Sheets("Temp").Range("B5") = 5 Then Sheets(Maand).Range("R" & result & ":U" & result) = "x"
If Sheets("Temp").Range("C6") = 1 And Sheets("Temp").Range("B6") = 6 Then Sheets(Maand).Range("V" & result & ":Y" & result) = "x"
If Sheets("Temp").Range("C7") = 1 And Sheets("Temp").Range("B7") = 7 Then Sheets(Maand).Range("Z" & result & ":AC" & result) = "x"
If Sheets("Temp").Range("C8") = 1 And Sheets("Temp").Range("B8") = 8 Then Sheets(Maand).Range("AD" & result & ":AG" & result) = "x"
If Sheets("Temp").Range("C9") = 1 And Sheets("Temp").Range("B9") = 9 Then Sheets(Maand).Range("AH" & result & ":AK" & result) = "x"
If Sheets("Temp").Range("C10") = 1 And Sheets("Temp").Range("B10") = 10 Then Sheets(Maand).Range("AL" & result & ":AO" & result) = "x"
If Sheets("Temp").Range("C11") = 1 And Sheets("Temp").Range("B11") = 11 Then Sheets(Maand).Range("AP" & result & ":AS" & result) = "x"
If Sheets("Temp").Range("C12") = 1 And Sheets("Temp").Range("B12") = 12 Then Sheets(Maand).Range("AT" & result & ":AW" & result) = "x"
If Sheets("Temp").Range("C13") = 1 And Sheets("Temp").Range("B13") = 13 Then Sheets(Maand).Range("AX" & result & ":BA" & result) = "x"
If Sheets("Temp").Range("C14") = 1 And Sheets("Temp").Range("B14") = 14 Then Sheets(Maand).Range("BB" & result & ":BE" & result) = "x"
If Sheets("Temp").Range("C15") = 1 And Sheets("Temp").Range("B15") = 15 Then Sheets(Maand).Range("BF" & result & ":BI" & result) = "x"
If Sheets("Temp").Range("C16") = 1 And Sheets("Temp").Range("B16") = 16 Then Sheets(Maand).Range("BJ" & result & ":BM" & result) = "x"
If Sheets("Temp").Range("C17") = 1 And Sheets("Temp").Range("B17") = 17 Then Sheets(Maand).Range("BN" & result & ":BQ" & result) = "x"
If Sheets("Temp").Range("C18") = 1 And Sheets("Temp").Range("B18") = 18 Then Sheets(Maand).Range("BR" & result & ":BU" & result) = "x"
If Sheets("Temp").Range("C19") = 1 And Sheets("Temp").Range("B19") = 19 Then Sheets(Maand).Range("BV" & result & ":BY" & result) = "x"
If Sheets("Temp").Range("C20") = 1 And Sheets("Temp").Range("B20") = 20 Then Sheets(Maand).Range("BZ" & result & ":CC" & result) = "x"
If Sheets("Temp").Range("C21") = 1 And Sheets("Temp").Range("B21") = 21 Then Sheets(Maand).Range("CD" & result & ":CG" & result) = "x"
If Sheets("Temp").Range("C22") = 1 And Sheets("Temp").Range("B22") = 22 Then Sheets(Maand).Range("CH" & result & ":CK" & result) = "x"
If Sheets("Temp").Range("C23") = 1 And Sheets("Temp").Range("B23") = 23 Then Sheets(Maand).Range("CL" & result & ":CO" & result) = "x"
If Sheets("Temp").Range("C24") = 1 And Sheets("Temp").Range("B24") = 24 Then Sheets(Maand).Range("CP" & result & ":CS" & result) = "x"
If Sheets("Temp").Range("C25") = 1 And Sheets("Temp").Range("B25") = 25 Then Sheets(Maand).Range("CT" & result & ":CW" & result) = "x"
If Sheets("Temp").Range("C26") = 1 And Sheets("Temp").Range("B26") = 26 Then Sheets(Maand).Range("CX" & result & ":DA" & result) = "x"
If Sheets("Temp").Range("C27") = 1 And Sheets("Temp").Range("B27") = 27 Then Sheets(Maand).Range("DB" & result & ":DE" & result) = "x"
If Sheets("Temp").Range("C28") = 1 And Sheets("Temp").Range("B28") = 28 Then Sheets(Maand).Range("DF" & result & ":DI" & result) = "x"
If Sheets("Temp").Range("C29") = 1 And Sheets("Temp").Range("B29") = 29 Then Sheets(Maand).Range("DJ" & result & ":DM" & result) = "x"
If Sheets("Temp").Range("C30") = 1 And Sheets("Temp").Range("B30") = 30 Then Sheets(Maand).Range("DN" & result & ":DQ" & result) = "x"
If Sheets("Temp").Range("C31") = 1 And Sheets("Temp").Range("B31") = 31 Then Sheets(Maand).Range("DR" & result & ":DU" & result) = "x"
If Sheets("Temp").Range("C32") = 1 And Sheets("Temp").Range("B32") = 1 Then Sheets(Maand).Range("B" & result & ":E" & result) = "x"
If Sheets("Temp").Range("C33") = 1 And Sheets("Temp").Range("B33") = 2 Then Sheets(Maand).Range("F" & result & ":I" & result) = "x"
If Sheets("Temp").Range("C34") = 1 And Sheets("Temp").Range("B34") = 3 Then Sheets(Maand).Range("J" & result & ":M" & result) = "x"
If Sheets("Temp").Range("C35") = 1 And Sheets("Temp").Range("B35") = 4 Then Sheets(Maand).Range("N" & result & ":Q" & result) = "x"
If Sheets("Temp").Range("C36") = 1 And Sheets("Temp").Range("B36") = 5 Then Sheets(Maand).Range("R" & result & ":U" & result) = "x"
If Sheets("Temp").Range("C37") = 1 And Sheets("Temp").Range("B37") = 6 Then Sheets(Maand).Range("V" & result & ":Y" & result) = "x"
If Sheets("Temp").Range("C38") = 1 And Sheets("Temp").Range("B38") = 7 Then Sheets(Maand).Range("Z" & result & ":AC" & result) = "x"
If Sheets("Temp").Range("C39") = 1 And Sheets("Temp").Range("B39") = 8 Then Sheets(Maand).Range("AD" & result & ":AG" & result) = "x"
If Sheets("Temp").Range("C40") = 1 And Sheets("Temp").Range("B40") = 9 Then Sheets(Maand).Range("AH" & result & ":AK" & result) = "x"
If Sheets("Temp").Range("C41") = 1 And Sheets("Temp").Range("B41") = 10 Then Sheets(Maand).Range("AL" & result & ":AO" & result) = "x"
If Sheets("Temp").Range("C42") = 1 And Sheets("Temp").Range("B42") = 11 Then Sheets(Maand).Range("AP" & result & ":AS" & result) = "x"
If Sheets("Temp").Range("C43") = 1 And Sheets("Temp").Range("B43") = 12 Then Sheets(Maand).Range("AT" & result & ":AW" & result) = "x"
If Sheets("Temp").Range("C44") = 1 And Sheets("Temp").Range("B44") = 13 Then Sheets(Maand).Range("AX" & result & ":BA" & result) = "x"
If Sheets("Temp").Range("C45") = 1 And Sheets("Temp").Range("B45") = 14 Then Sheets(Maand).Range("BB" & result & ":BE" & result) = "x"
If Sheets("Temp").Range("C46") = 1 And Sheets("Temp").Range("B46") = 15 Then Sheets(Maand).Range("BF" & result & ":BI" & result) = "x"
If Sheets("Temp").Range("C47") = 1 And Sheets("Temp").Range("B47") = 16 Then Sheets(Maand).Range("BJ" & result & ":BM" & result) = "x"
If Sheets("Temp").Range("C48") = 1 And Sheets("Temp").Range("B48") = 17 Then Sheets(Maand).Range("BN" & result & ":BQ" & result) = "x"
If Sheets("Temp").Range("C49") = 1 And Sheets("Temp").Range("B49") = 18 Then Sheets(Maand).Range("BR" & result & ":BU" & result) = "x"
If Sheets("Temp").Range("C50") = 1 And Sheets("Temp").Range("B50") = 19 Then Sheets(Maand).Range("BV" & result & ":BY" & result) = "x"
If Sheets("Temp").Range("C51") = 1 And Sheets("Temp").Range("B51") = 20 Then Sheets(Maand).Range("BZ" & result & ":CC" & result) = "x"
If Sheets("Temp").Range("C52") = 1 And Sheets("Temp").Range("B52") = 21 Then Sheets(Maand).Range("CD" & result & ":CG" & result) = "x"
If Sheets("Temp").Range("C53") = 1 And Sheets("Temp").Range("B53") = 22 Then Sheets(Maand).Range("CH" & result & ":CK" & result) = "x"
If Sheets("Temp").Range("C54") = 1 And Sheets("Temp").Range("B54") = 23 Then Sheets(Maand).Range("CL" & result & ":CO" & result) = "x"
If Sheets("Temp").Range("C55") = 1 And Sheets("Temp").Range("B55") = 24 Then Sheets(Maand).Range("CP" & result & ":CS" & result) = "x"
If Sheets("Temp").Range("C56") = 1 And Sheets("Temp").Range("B56") = 25 Then Sheets(Maand).Range("CT" & result & ":CW" & result) = "x"
If Sheets("Temp").Range("C57") = 1 And Sheets("Temp").Range("B57") = 26 Then Sheets(Maand).Range("CX" & result & ":DA" & result) = "x"
If Sheets("Temp").Range("C58") = 1 And Sheets("Temp").Range("B58") = 27 Then Sheets(Maand).Range("DB" & result & ":DE" & result) = "x"
If Sheets("Temp").Range("C59") = 1 And Sheets("Temp").Range("B59") = 28 Then Sheets(Maand).Range("DF" & result & ":DI" & result) = "x"
If Sheets("Temp").Range("C60") = 1 And Sheets("Temp").Range("B60") = 29 Then Sheets(Maand).Range("DJ" & result & ":DM" & result) = "x"
End Sub
I hope you can help me out.
Thanx
Delftsblauw