+ Reply to Thread
Results 1 to 5 of 5

Copy and Paste based on a hlookup

  1. #1
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Copy and Paste based on a hlookup

    Hi,

    I need to create a macro that will look at a user selection of the month and then copy the actuals to date that match that selection and overwrite what is in as forecast.

    I have attached a two tab example of what I mean. Basically in sheet 1 there is forecast for the year on the left and then actuals for the year to date on right. On sheet 2 the user will select which is the latest month they have actuals for and then they can press a button and all the actuals will over write what is in the forecast.

    Some limitations are I don't want any months that are still forecast to be overwritten and there will be further information down below so can't copy the entire column has to be limited to a certain number of rows.

    Any help is greatly appreciated as I have been going around in circles on this one for a while...

    Thanks,
    Tony
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy and Paste based on a hlookup

    Please Login or Register  to view this content.

    Kind regards
    Leo
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copy and Paste based on a hlookup

    Thanks Leo

    I can follow this through and now editing it to work with the live version the only part I don't follow is the line:

    .Range(.Cells(4, 18), .Cells(lastrow, 18 + mycol - 1)).Copy .Range("B4")

    Are you able to just break it down (particularly the first part) so I can know what to edit it to in the live version?

    Thanks again,
    Tony

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy and Paste based on a hlookup

    Hi Tony

    Cells(4,18) is same as Range("R4"), so just change 18 to columnnumber where is first month in live version.
    also change the range in application.match


    Kind regards
    Leo

  5. #5
    Registered User
    Join Date
    06-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Copy and Paste based on a hlookup

    Thanks Leo, I understand now - and my problem is solved

+ 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. Copy and paste data from master based on a specific format based on Invoice number
    By anandnair1983 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 06:32 AM
  2. Replies: 0
    Last Post: 09-28-2015, 06:32 AM
  3. Copy paste based on value
    By GeekiInPink in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-16-2015, 09:53 PM
  4. Replies: 0
    Last Post: 10-29-2013, 09:38 AM
  5. Copy and Paste Rows based on Criteria onto another sheet and sort based on oldest item
    By Kushal8684 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2013, 05:37 AM
  6. [SOLVED] Excel 2007 : hlookup copy and paste across an array help
    By Martin Chamberlin in forum Excel General
    Replies: 5
    Last Post: 05-22-2012, 11:15 PM
  7. Copy row based on date and then paste into a new worksheet based on section number
    By calmlaunch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-25-2011, 11:40 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