+ Reply to Thread
Results 1 to 2 of 2

Macro to copy and paste variable depending on cell content

  1. #1
    Registered User
    Join Date
    10-21-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    1

    Macro to copy and paste variable depending on cell content

    Hi all,

    I'm quite new to macros and have only really used the recorder.

    I've created a workbook which has a dropdown list of names. The is also various data related to each name that will be imported into a second sheet each day.

    I was hoping to use the macro recorder to make a macro which would copy the name that is selected in the drop down box, automatically filter on this name in the sheet with the imported data, and then copy and paste the data back into the front sheet.

    The issue I have is that when I run the macro, it always filters on the name in the dropdown list when the macro was recorded.

    The code is below. I can see that in Criteria1 it is equal to the name which was selected when recorded; is there any way to make this a variable, depending on what has been copied?

    Please Login or Register  to view this content.
    Thanks for your help. I have also attached an example workbook.Example.xlsm


    Moderator Edit:

    Welcome to the forum, ejh88.

    Please notice that [CODE] tags have been added to your post. The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
    Thanks.
    Last edited by Cutter; 10-21-2012 at 04:43 PM. Reason: Added code tags

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Macro to copy and paste variable depending on cell content

    Give this a try. Put into the Front Sheet worksheet Module

    Please Login or Register  to view this content.
    Last edited by mike7952; 10-21-2012 at 06:42 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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