How to Create Macro to Search, Copy, & Paste? [Closed]

Report
Posts
2
Registration date
Wednesday October 29, 2014
Status
Member
Last seen
October 30, 2014
-
I have Two Excel sheets Sheet2: Database file(Row wise Data has been updated i.e only in A column- refer below


A1: Name      
A2 : person name
A3: Company
A4 : Company name
A5: City
A6 : City place

A7:Blank cell
A8: Blank cell
A9:Telephone
A10 : Blank cell

A11 : Blank cell

A12:Mobile
A13: XXXXX

A15: Name
A16 : person name

A17: Company
A18 : Company name

A19: City
A20 : City place


A21:Blank cell
A22: Blank cell

A23:Telephone
A24 : Blank cell

A25 : Blank cell

A26:Mobile
A27: XXXXX


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

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


**Name Company Title City Telephone State Mobile Country Email Area of responsibility Business focus**


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 )

2. 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.

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!