I_need_help
New Member
hey there,
I started using macro's very recently, so I am below beginners level. I have a problem where I'm struggling with for days now.
I made a code to copy 2 dynamic ranges (columns B and D, from a pivot on sheet "FIFO list") and paste them underneath the last row with data into the sheet "FIFO tracker" in columns B and C. I handle them as 2 copy/paste operations in my code.
In column A of sheet "FIFO tracker" I want to add a date (just the date of today, I am running the file daily) and to downfill this date until the lastrow with data which I copied earlier. Unfortunately this line of my code doesn't do anything.
Now the 2 ranges are copied when I run the macro, but the 2nd paste operation pastes the data underneath the last row of the 1st paste operation. It should be pasted next to each other.
I hope someone could point me out where my mistakes are? all help is much appreciated... !
I started using macro's very recently, so I am below beginners level. I have a problem where I'm struggling with for days now.
I made a code to copy 2 dynamic ranges (columns B and D, from a pivot on sheet "FIFO list") and paste them underneath the last row with data into the sheet "FIFO tracker" in columns B and C. I handle them as 2 copy/paste operations in my code.
In column A of sheet "FIFO tracker" I want to add a date (just the date of today, I am running the file daily) and to downfill this date until the lastrow with data which I copied earlier. Unfortunately this line of my code doesn't do anything.
Now the 2 ranges are copied when I run the macro, but the 2nd paste operation pastes the data underneath the last row of the 1st paste operation. It should be pasted next to each other.
I hope someone could point me out where my mistakes are? all help is much appreciated... !
Code:
Sub Test_FIFO_Tracker()
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Dim LastRow As Long
Set copySheet = Worksheets("FIFO list")
Set pasteSheet = Worksheets("FIFO tracker")
LastRow = copySheet.Cells(Rows.Count, 3).End(xlUp).Row
copySheet.Range("B11:B" & LastRow).Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 1).PasteSpecial xlPasteValuesAndNumberFormats
copySheet.Range("D11:K" & LastRow).Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 2).PasteSpecial xlPasteValuesAndNumberFormats
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = Format(Date, "DD-MM-YYYY").FillDown
End Sub