Results 1 to 7 of 7

Jump back and forth between two sheets to copy values

Threaded View

ismafoot Jump back and forth between... 10-12-2018, 09:19 PM
alansidman Re: Jump back and forth... 10-12-2018, 10:39 PM
ismafoot Re: Jump back and forth... 10-12-2018, 11:09 PM
alansidman Re: Jump back and forth... 10-12-2018, 11:17 PM
ismafoot Re: Jump back and forth... 10-12-2018, 11:20 PM
alansidman Re: Jump back and forth... 10-12-2018, 11:37 PM
ismafoot Re: Jump back and forth... 10-13-2018, 08:40 AM
  1. #1
    Registered User
    Join Date
    05-24-2018
    Location
    Canada
    MS-Off Ver
    Windows 7
    Posts
    35

    Jump back and forth between two sheets to copy values

    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
    Last edited by jeffreybrown; 10-12-2018 at 09:22 PM. Reason: Please use code tags!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy a range, and then paste back the values only.
    By Angry Robot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2017, 12:42 PM
  2. Replies: 5
    Last Post: 09-16-2014, 12:17 PM
  3. Jump back and forth between sheets
    By pigpen in forum Excel General
    Replies: 1
    Last Post: 09-05-2014, 01:47 PM
  4. Copy Cell Values in two Columns down x number of times then jump and copy some more.
    By scholly23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2014, 03:19 AM
  5. [SOLVED] Jump to a cell and back??
    By ladi100 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-17-2013, 05:30 AM
  6. Need a Macro to Jump back to previous page
    By MD77614 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2012, 02:48 PM
  7. Closing sheets as I jump back to main sheet
    By dollydoodah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2011, 09:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1