+ Reply to Thread
Results 1 to 10 of 10

Copying specific cells and pasting in specific location VBA Help.

  1. #1
    Registered User
    Join Date
    06-07-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    28

    Question Copying specific cells and pasting in specific location VBA Help.

    Good evening all,

    I need VBA to select Cells B3:G3 down to the last cell with data and then have it copy and paste to another work sheet,
    How would I be best going about this?

    Regards
    N3
    Last edited by N3CREN; 09-20-2018 at 03:17 PM.

  2. #2
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Probably a stupid question but I'm stuck

    If you are working with static ranges/cells (e.g. always pasting to the same cell(s) on the second worksheet) then something simple should suffice...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-07-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    28

    Re: Probably a stupid question but I'm stuck

    Hey thanks for the quick response,

    The cells that I need to copy from B3:G3 always go to "sheet 1" however needs to go to the next available blank cell, I have set up a seperate VBA script that goes to the next blank cell on the sheet but not sure how I would tie it into that code above

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Probably a stupid question but I'm stuck

    title updated......
    Last edited by protonLeah; 09-20-2018 at 05:29 PM.
    Ben Van Johnson

  5. #5
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Probably a stupid question but I'm stuck

    Try this instead. It calculates the last row of data in the source sheet (change name as needed), as well as the next available row in the destination sheet (RP_DATA).
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-07-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    28

    Re: Copying specific cells and pasting in specific location VBA Help.

    That works brilliantly,

    However the only issue i'm having now is a similar sheet only I copy A2:B2 (and all cells with data below) and paste into another sheet same scenario as before columns A:B next row. I've tried reusing the above but it works with the invcut but then not this one

  7. #7
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Copying specific cells and pasting in specific location VBA Help.

    Not sure what "invcut" is, but you may need to get the lastrow value from column A instead of column B in this case? (And set the copy range to "A2:B" & lastrow)
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-07-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    28

    Re: Copying specific cells and pasting in specific location VBA Help.

    So my only issue now is that the above doesn't work if you don't use Refresh all in the data tab before running the macro.

    Even though I have VBA Do a refresh all before calling upon each macro

    How do I solve this

    Please Login or Register  to view this content.

    **Solved the issue**
    Last edited by N3CREN; 09-21-2018 at 02:05 PM.

  9. #9
    Forum Contributor
    Join Date
    09-19-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    208

    Re: Copying specific cells and pasting in specific location VBA Help.

    If you wouldn't mind, please post how you solved your issue - to the benefit of others who might read this post in the future.

  10. #10
    Registered User
    Join Date
    06-07-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    28

    Re: Copying specific cells and pasting in specific location VBA Help.

    Good idea! although it was pretty simple,

    I added a doevents under the refresh all command and also set the background refresh to off in queries.
    No matter what I tried before this the copying of the Query from my Transform and get would only work if it was refreshed before running the macro

    Please Login or Register  to view this content.

+ 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. Stuck with SUMIF and MONTH (and I feel stupid)
    By schallpattern in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-28-2016, 04:18 PM
  2. Replies: 3
    Last Post: 06-17-2011, 08:09 AM
  3. This is probably a really stupid question
    By Feline in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 03-15-2007, 07:26 AM
  4. Stupid Question
    By o5prey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2006, 06:51 PM
  5. Stupid Question
    By mastermind in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2006, 02:05 PM
  6. Stupid, stupid question....
    By DS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2005, 11:05 AM
  7. Stupid question...
    By zigtag3d in forum Excel General
    Replies: 0
    Last Post: 03-26-2005, 06:35 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