![]()
Sub WeekA() Dim ws As Worksheet Set ws = ActiveSheet Dim Previousrow As Long Previousrow = Cells(Rows.Count - 5, "B").End(xlUp).Row 'this isn't going to do what you think it is going to do Dim Lastrow As Long Lastrow = Cells(Rows.Count, "B").End(xlUp).Row Dim Newrow As Long 'Newrow = Cells(Rows.Count + 5, "B").End(xlUp).Row 'This will error. Rows.Count + 5 is like saying infinity plus 5. Just doesn't work 'If Newrow worked; Previousrow, Lastrow, & Newrow will all give the same row (unless all rows in your worksheet are full). You are doing something wrong MsgBox (Previousrow & " " & Lastrow) 'example Sheets("Sheet2").Range("A3:I7").Copy ws.Range("A" & Rows.Count).End(3)(2) Range("B126:C130").AutoFill Destination:=Range("B126:C135"), Type:=xlFillWeekdays 'needs to reference a worksheet in both first range and destination range 'If you want to incorporate first and last row into a range it would be something like this; with a proper previousrow 'ws.Range("B" & Previousrow, "C" & Lastrow).AutoFill Destination:=ws.Range("B" & Previousrow, "C" & Lastrow), Type:=xlFillWeekdays End Sub
Bookmarks