Results 1 to 9 of 9

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

Threaded View

  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


    Sheets("Sheet2").Select
     Range("A1").Select
        Selection.Copy
        Sheets("Sheet1").Select
        Cells.Find(What:="Name", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
            xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate
        Range("A37").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet2").Select
        Range("A2").Select
        ActiveSheet.Paste
    
    Sheets("Sheet1").Select
    Application.CutCopyMode = False
    Cells.Find(What:="Name", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False).Activate
    Range("A71").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A3").Select
    ActiveSheet.Paste

    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.

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