Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro with a variable search feature?
I have 3 excel documents.
1 has single column with 20 rows containing unique numbers. 2nd has 8 columns with 936 rows 3rd is blank I want to write a macro that will copy an individual number in the first document, search for it in the 2nd document, copy the entire row holding that number from the 2nd and paste it into the 3rd blank document and cursor down one row. I then want it to go back to the 1st document cursor down one row and end. When I try to write the macro, it records the first number from the first document within the macro, so it won't automatically search for the document within the row I am in. Any help would be appreciated. -- -- Mary |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro with a variable search feature?
Please post your code.
"punkyfire" wrote: I have 3 excel documents. 1 has single column with 20 rows containing unique numbers. 2nd has 8 columns with 936 rows 3rd is blank I want to write a macro that will copy an individual number in the first document, search for it in the 2nd document, copy the entire row holding that number from the 2nd and paste it into the 3rd blank document and cursor down one row. I then want it to go back to the 1st document cursor down one row and end. When I try to write the macro, it records the first number from the first document within the macro, so it won't automatically search for the document within the row I am in. Any help would be appreciated. -- -- Mary |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I create a macro with a variable search feature?
Sub Cull()
' ' Cull Macro ' Macro recorded 6/14/2007 by ' ' Keyboard Shortcut: Ctrl+k ' Selection.Copy Windows("C02_ORIG_LOST_52307.xls").Activate Cells.Find(What:="5010045", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Offset(0, -6).Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Application.CutCopyMode = False Selection.Copy Windows("Culled_ICNs.xls").Activate ActiveSheet.Paste ActiveCell.Offset(1, 0).Range("A1").Select Windows("C02_Extracts.xls").Activate ActiveCell.Offset(1, 0).Range("A1").Select End Sub -- Mary "Toppers" wrote: Please post your code. "punkyfire" wrote: I have 3 excel documents. 1 has single column with 20 rows containing unique numbers. 2nd has 8 columns with 936 rows 3rd is blank I want to write a macro that will copy an individual number in the first document, search for it in the 2nd document, copy the entire row holding that number from the 2nd and paste it into the 3rd blank document and cursor down one row. I then want it to go back to the 1st document cursor down one row and end. When I try to write the macro, it records the first number from the first document within the macro, so it won't automatically search for the document within the row I am in. Any help would be appreciated. -- -- Mary |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create a macro to search an excel spread for duplicates | Excel Worksheet Functions | |||
How to Create a Macro to Edit a Variable Amount of Information | New Users to Excel | |||
Excel list feature should search with more than first character | Excel Worksheet Functions | |||
Search feature not too helpful | Excel Discussion (Misc queries) | |||
Search feature in workbook | Excel Worksheet Functions |