I've got o problem with my macro:
Dim nr_kol As Integer
nr_kol = ActiveCell.Column
Worksheets("dane").Range("I1").Copy
Worksheets("dystr hist").Range("a1").Select
ActiveCell.End(xlToRight).Offset(0, 1).PasteSpecial xlPasteValues
Do While Not ActiveCell.Offset(0, -nr_kol + 1) = ""
Selection.Offset(1, 0).Select
ActiveCell.Value = Application.VLookup(ActiveCell.Offset(0, -nr_kol + 1).Text, Worksheets("temp2").Range("B:I"), 8, False)
Loop
It should work like this: it takes week number from "dane" sheet and paste it in "dystr hist" sheet in first free cell in first row. Then we have vlookup for items, until the list is finished. It worked for previous sheet, but in this particular place it crashes with type mismatch. Can anyone explain me why?