I am pretty new to coding and wrote a bit of code which doesn't work and I understand why, but can't figure out a way to solve it. What I want to do is that my code checks each cell in column B what number is displayed and then fills in the according string in column E. My Problem is that my Loop doesn't work, because I probably should use the "for each" Loop or not? and that I can't figure out how to do my ifclause without using Ranges but instead cells. Thank you for your time and help!
Dim x As Long
For x = 2 To 1000
Range ("E" & x)
If Range("B2") = 6002 Then
Range("E2") = "Gehälter " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6003 Then
Range("E2") = "Üst-Pauschale " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6027 Then
Range("E2") = "Sonderzahlung " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6110 Then
Range("E2") = "SV-DG Anteil " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6211 Then
Range("E2") = "MVK " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6410 Then
Range("E2") = "Dienstgeberbeitrag " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6420 Then
Range("E2") = "Dienstgeberzuschlag " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6430 Then
Range("E2") = "Kommunalsteuer " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6691 Then
Range("E2") = "Km-Geld " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 7731 Then
Range("E2") = "Reisekosten " & Month(Range("G2")) & "/2016"
ElseIf Range("B2") = 6035 Then
Range("E2") = "Sonstige Zulagen " & Month(Range("G2")) & "/2016"
Else: Range("E2") = ""
End If
Next x
That is what it should look like! enter image description here
Aucun commentaire:
Enregistrer un commentaire