+ Reply to Thread
Results 1 to 9 of 9

How to Create Macro to Search, Copy, & Paste?

  1. #1
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Question How to Create Macro to Search, Copy, & Paste?

    I have Two Excel sheets Sheet2: Database file(Row wise Data has been updated i.e only in A column- refer below

    HTML Code: 
    Sheet1: MIS Report (with the heading of the columns).

    In Sheet1 -i have populated the headings like Name , Company, city etc.


    HTML Code: 

    Macro Requirement :

    So here,i wanted to create a macro to search for all the same heading names and copy the next row data and paste into under respective headings in Sheet 1

    Please do let me know if you have any questions on the same and Thanks a ton in Advance.

    Example references :

    Sheet 2 : Data (A) - looks like as below


    Name
    Arun
    Company
    XXXX
    Title
    Business Team





    City
    LONDON
    Telephone


    State
    LONDON
    Mobile


    Country
    United Kingdom
    Email



    Area of responsibility
    Sales
    Business focus
    Securities
    Name Vijay Company XXXX Title Business Team

    City
    LONDON
    Telephone


    State
    LONDON
    Mobile


    Country
    United Kingdom
    Email



    Area of responsibility
    Sales
    Business focus
    Securities

    1. Like this i have 20000 rows in a A column , here now i wanted to search in a "Sheet2" with the heading name of Sheet1 (Ex :Name,Company )
    copy the next row data and paste into sheet1 under respective headings

    3.we should do Find NEXT until we copied all the data
    Here is the Macro code that i have recorded


    Please Login or Register  to view this content.

    Note: There are few blanks rows in between(Sheet1)

    I have no idea how to create a macro however i have searched all over the internet to find one that i could modify to insert my own data, and this is what ive come up with.

    Please help.
    Last edited by hariexcel1987; 10-30-2014 at 09:54 AM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Create Macro to Search, Copy, & Paste?

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to Create Macro to Search, Copy, & Paste?

    Herewith enclosed is the sample excel file, kindly help.
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Create Macro to Search, Copy, & Paste?

    Try this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to Create Macro to Search, Copy, & Paste?

    Wow, Fantastic mind blowing & unbelievable .It's working fine.


    Thanks a ton, Thanks Thanks Thanks

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Create Macro to Search, Copy, & Paste?

    Happy to help.

    Don't forget to mark the thread solved, and add reputation to helpful posts.

  7. #7
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to Create Macro to Search, Copy, & Paste?

    Hi ,


    I am getting few technical errors, especially company name is not copied properly .

    Herewith attached are the examples, can you please fix this.

    Regards,
    Hari
    Attached Files Attached Files

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to Create Macro to Search, Copy, & Paste?

    Ah yes, it's including partial matches, so it matches "NY" with "CompaNY" :D

    Easy to fix - change this line:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-17-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: How to Create Macro to Search, Copy, & Paste?

    Wow, you are really a Genius.

    I will get this thread as solved. Many thanks.

+ 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. [SOLVED] Vba/Macro Search Rows for value and copy/paste accordingly
    By Aquabat in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-21-2013, 02:56 PM
  2. [SOLVED] Search, copy & paste Macro
    By Keixm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2012, 12:11 PM
  3. Search, Copy Paste Macro
    By crazyAMP in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 11-17-2011, 04:47 PM
  4. vba macro - search ID, copy, paste
    By sgp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 07:00 AM
  5. Search, copy and paste macro.
    By Shin278 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2011, 07:42 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