Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a macro to search an excel spread for duplicates jamalin Excel Worksheet Functions 4 February 16th 07 10:58 AM
How to Create a Macro to Edit a Variable Amount of Information Matt New Users to Excel 4 August 12th 06 10:05 PM
Excel list feature should search with more than first character DebugNT Excel Worksheet Functions 0 June 28th 06 11:26 AM
Search feature not too helpful famdamly Excel Discussion (Misc queries) 1 February 27th 06 01:03 AM
Search feature in workbook nkt122866 Excel Worksheet Functions 0 September 14th 05 10:24 PM


All times are GMT +1. The time now is 09:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"