I am struggling with this code and I don't understand why it's causing an issue.
ActiveSheet.Range("B1:E" & lastrow).Copy
ActiveSheet.Range("B1").Select
Selection.PasteSpecial xlPasteValues
ActiveSheet.Name = startday & "_" & startmonth & "_" & startyear
This keeps generating an error on line three.
Originally I simply had "Range("B1").pastespecial" etc, but this was pasting into another open workbook, even though it was not the active sheet.
I have tried about 70 or 80 different possible alternative approaches, and I cannot get it to do something which I regard as fairly simple - namely copy this range and paste them as values in the same location, in the same sheet.
ActiveSheet
:) It's always better to explicitly declare and assign worksheet variables, rather than rely on the user to keep the appropriate sheet active throughout runtime. – David Zemenslastrow
definition – user3598756