I'm trying to copy values from one sheet to another, if the conditions are right. I did it with 3 nested loops. Unfortunately the code only gives me the first value.
for example:
i = 7, j = 3, k = 2
(i, j) = (7,3) is an "E" in the "Januar" sheet. This E is then continuously copied and pasted.
But I want the second value (i, j) = (7,4), which is an "U" copied and pasted and so on...
I don't quite understand where the problem is in my code. I would be glad if someone can help me. I would also be happy about a better and faster solution.
Dim i As Integer, Dim j As Integer, Dim k As Integer
For i = 7 To 37
If Worksheets("Januar").Cells(i, 2).Value = Worksheets("Drucken").Cells(12, 12).Value Then
For j = 3 To 5
Worksheets("Januar").Cells(i, j).Copy
For k = 2 To 4
Worksheets("Drucken").Activate
Worksheets("Drucken").Cells(38, k).Select
ActiveSheet.Paste
Next
Worksheets("Januar").Activate
Next
End If
Next
EDIT:
Here is what I want
I want these values from Sheet("Januar") copied and pasted into

I solved the problem like this:
Dim i As Integer
For i = 7 To 37
If Worksheets("Januar").Cells(i, 2).Value = Worksheets("Drucken").Cells(12, 12).Value Then
Worksheets("Januar").Cells(i, 3).Copy Worksheets("Drucken").Cells(38, 2)
Worksheets("Januar").Cells(i, 4).Copy Worksheets("Drucken").Cells(38, 3)
Worksheets("Januar").Cells(i, 5).Copy Worksheets("Drucken").Cells(38, 4)
Worksheets("Januar").Cells(i, 6).Copy Worksheets("Drucken").Cells(38, 5)
Worksheets("Januar").Cells(i, 7).Copy Worksheets("Drucken").Cells(38, 6)
Worksheets("Januar").Cells(i, 8).Copy Worksheets("Drucken").Cells(38, 7)
Worksheets("Januar").Cells(i, 9).Copy Worksheets("Drucken").Cells(38, 8)
Worksheets("Januar").Cells(i, 10).Copy Worksheets("Drucken").Cells(38, 9)
Worksheets("Januar").Cells(i, 11).Copy Worksheets("Drucken").Cells(38, 10)
Worksheets("Januar").Cells(i, 12).Copy Worksheets("Drucken").Cells(38, 11)
Worksheets("Januar").Cells(i, 13).Copy Worksheets("Drucken").Cells(38, 12)
Worksheets("Januar").Cells(i, 14).Copy Worksheets("Drucken").Cells(38, 13)
Worksheets("Januar").Cells(i, 15).Copy Worksheets("Drucken").Cells(38, 14)
Worksheets("Januar").Cells(i, 16).Copy Worksheets("Drucken").Cells(38, 15)
Worksheets("Januar").Cells(i, 17).Copy Worksheets("Drucken").Cells(38, 16)
Worksheets("Januar").Cells(i, 18).Copy Worksheets("Drucken").Cells(38, 17)
Worksheets("Januar").Cells(i, 19).Copy Worksheets("Drucken").Cells(38, 18)
Worksheets("Januar").Cells(i, 20).Copy Worksheets("Drucken").Cells(38, 19)
Worksheets("Januar").Cells(i, 21).Copy Worksheets("Drucken").Cells(38, 20)
Worksheets("Januar").Cells(i, 22).Copy Worksheets("Drucken").Cells(38, 21)
Worksheets("Januar").Cells(i, 23).Copy Worksheets("Drucken").Cells(38, 22)
Worksheets("Januar").Cells(i, 24).Copy Worksheets("Drucken").Cells(38, 23)
Worksheets("Januar").Cells(i, 25).Copy Worksheets("Drucken").Cells(38, 24)
Worksheets("Januar").Cells(i, 26).Copy Worksheets("Drucken").Cells(38, 25)
Worksheets("Januar").Cells(i, 27).Copy Worksheets("Drucken").Cells(38, 26)
Worksheets("Januar").Cells(i, 28).Copy Worksheets("Drucken").Cells(38, 27)
Worksheets("Januar").Cells(i, 29).Copy Worksheets("Drucken").Cells(38, 28)
Worksheets("Januar").Cells(i, 30).Copy Worksheets("Drucken").Cells(38, 29)
Worksheets("Januar").Cells(i, 31).Copy Worksheets("Drucken").Cells(38, 30)
Worksheets("Januar").Cells(i, 32).Copy Worksheets("Drucken").Cells(38, 31)
Worksheets("Januar").Cells(i, 33).Copy Worksheets("Drucken").Cells(38, 32)
End If
Next
But I think with for next loops its way better. But I dont know why its not working with the code above...

For....Nextloops don't work the way you are thinking, but without the sample I can't be sureWorksheets("Januar").Cells(i, j)value on the same row (38) in columns 2 to 4. At the secondjiteration it overwrite the previous returned values and it returns only the last iteration result. Where would you like to copy that values (more then three) for each iteration? Do you like copying on the next empty column of the same 38 row? Do you like incrementing the row, too? What do you want, in fact?Worksheets("Januar").Cells(i, 2).Value = Worksheets("Drucken").Cells(12, 12).Valuedoes mean, it is not possible to understand what you need. You show us the seventh row and your code processes rows from 7 to 37. What to understand from your answer update? From the second sheet, do you need only three such values to be returned? If not, why do you show us what you do not need?