+ Reply to Thread
Results 1 to 8 of 8

VBA to return to last ACTIVE Worksheet to copy additional data

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Question VBA to return to last ACTIVE Worksheet to copy additional data

    Hello All:

    This is frustrating as there are many "close but no cigar" solutions for my issue in cyberworld but none of them seem to do exactly what I need. Here we go:

    From any given sheet, I want to be able to copy data from a cell and paste it to a specific sheet (we'll call it the "report" sheet) and then go back to that previously active sheet and copy additional data and also paste that to the report sheet.

    I've seen several options for creating a button that will take you back to the last active worksheet, but nothing that simply runs within a single macro as part of it to go back and forth. The end result I'm looking for is to be able to copy data from the sheet a user is working with (1 of possibly 9) and paste it to the report sheet, but the data I need to copy is located in multiple areas of the original sheet (e.g. Cell A1 and Range B4:C30) so I (think I) need to go back and forth twice to copy - and then paste - the data from these two separate locations.

    I'm trying to avoid writing multiple macros for every sheet a user can be working with just to copy a few cells of data to a report.

    Help?

    As always, thanks in advance for any guidance! ExcelForum rocks!!!

    Seaplane Jack

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    You don't need to switch between sheets to copy/paste, so you could write code that never leavs the sheet you are copying from.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    You don't need to select a sheet, or a cell/range on that sheet, in order to copy it and paste it somewhere else. And you don't need to select a target sheet in order to paste the data there. So, why do you want/need to do that?

    With Sheet1 active, you could say:
    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    06-13-2012
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    Ok - I think I'm following the logic, but how do I get the data from Cell A1 of the Active sheet pasted to cell AA1 of the report sheet - and likewise the data from range B4:C30 pasted to AB1:AC30 of the report sheet.

    Perhaps I've got a mental block going on and I'm making this much harder than it needs to be!?!?

    Thanks!

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    All you need is this, obviously change 'ReportSheet' to the correct name for your 'report' sheet.
    Please Login or Register  to view this content.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    and I'm making this much harder than it needs to be!?!?
    Yep. Norie has provided the basic building block.

  7. #7
    Registered User
    Join Date
    06-13-2012
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    Thanks, Norie! It works perfectly! Clearly I WAS making it much harder than it had to be. I didn't realize you don't actually need a "paste" command to paste!

    Another satisfied customer...

    As you were!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: VBA to return to last ACTIVE Worksheet to copy additional data

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 07-03-2015, 04:27 AM
  2. [SOLVED] VBA Need help with additional loop to copy range to different worksheet
    By Old-One in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-14-2014, 05:19 PM
  3. Replies: 0
    Last Post: 04-28-2012, 06:06 PM
  4. Code to Read/Copy Data from Closed Wb and Return/Paste in Active Wb
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2010, 09:26 PM
  5. Basic Question - How do I return the worksheet number of the active worksheet?
    By Regnab in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2006, 10:10 PM
  6. [SOLVED] Copy data from 3rd worksheets and pasting to active worksheet
    By KimberlyC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-28-2005, 10:06 PM
  7. [SOLVED] sending the active worksheet and an additional new sheet
    By Qaspec in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2005, 11:06 PM

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