Dzień dobry.
Mój kod to:
Sheets("Backend").Range("B3").FormulaR1C1 = "=IF(Rejestr!R[-1]C=""U"",Rejestr!R[-1]C[9],"""")" Sheets("Backend").Range("B3").AutoFill Destination:=Range("B3:B411"), Type:=xlFillDefault Sheets("Backend").Columns("F:F").Copy Sheets("Backend").Range("I:I").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True, Transpose:=False Sheets("Backend").Columns("G:G").Copy Sheets("Backend").Range("K:K").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True, Transpose:=False Sheets("Backend").Application.CutCopyMode = False Sheets("Backend").Range("$I:$I").RemoveDuplicates Columns:=1, Header:=xlNo Sheets("Backend").Range("$K:$K").RemoveDuplicates Columns:=1, Header:=xlNo Dim rng As Range 'Store blank cells inside a variable Set rng = Sheets("Backend").Range("I:I").SpecialCells(xlCellTypeBlanks) 'Delete blank cells and shift upward rng.Rows.Delete Shift:=xlShiftUp 'Store blank cells inside a variable Set rng = Sheets("Backend").Range("K:K").SpecialCells(xlCellTypeBlanks) 'Delete blank cells and shift upward rng.Rows.Delete Shift:=xlShiftUp
W drugiej linijce kodu przy AutoFill wywala błąd. Proszę o pomoc - co jest nie tak?
Dodam, że kod jest uruchamiany na innym Sheet. Jeżeli ten, na którym ma się uruchomić jest zaznaczony, tj. "backend" - to wszystko działa poprawnie.