Hello,
I am having trouble in making this code work:
Sub newsheet()
'Allows the user to copy the active sheet and clear contents in columns payments and advances of each product.
Application.ActiveWorkbook.ActiveSheet.Select
Application.ActiveWorkbook.ActiveSheet.Copy After:=ActiveSheet
Range("C8:D38,H8:I38,M8:N38,R8:S38,W8:X38,AB8:AC38,AG8:AH38,AL8:AM38").Select
Selection.ClearContents
ActiveWorkbook.ActiveSheet.Range("A1").Select
Dim wks As Worksheet
Dim rng As Range
Set wks = Application.ActiveWorkbook.ActiveSheet.Previous
Set rng = wks.Range("E39")
' copies ending balance of previous sheet to beg. balance of newly created sheet.
Do While Not IsEmpty(rng)
rng.Copy
Application.ActiveWorkbook.Worksheets(wks.Index + 1).ActiveCell.Offset(-32, 0).PasteSpecial xlPasteValues
Set rng = rng.Offset(0, 4).Select
Loop 'Loops back through the previous sheet to until it doesnt find any product anymore.
End Sub
The error message (Object doesnt support this propety or method) occurs at the end of the code:
Application.ActiveWorkbook.Worksheets(wks.Index + 1).ActiveCell.Offset(-32, 0).PasteSpecial xlPasteValues
Bookmarks