Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Copying certain criteria from one worksheet to another

I am trying to create code that will look in one worksheet column for the
word Add, I then want it to copy certain fields in another worksheet based on
this. The code I have now will find the first unique field and copy it over,
I am trying to find a way to Vlookup that field and copy the rest of the
required fields. There are a total of 7 fields that I need to copy over,
including the first field, also the field locations on both worksheets vary.
Can anyone help me out. This is the code I have so far:

Sub NewOrders()
Dim FoundCell As Variant
Dim Job As range
Set FoundCell = Worksheets("Download").Columns("C").Find("Add")
Application.Calculation = xlCalculationAutomatic
Sheets("Download").Select
range(FoundCell.Address).Select
Do Until ActiveCell = "OK"
ActiveCell.Offset(0, 1).Select
Selection.Copy
Worksheets("MPS").Activate
ActiveCell.Offset(1, 0).Activate
ActiveCell.PasteSpecial _
Paste:=xlPasteValues, Operation:=xlPasteSpecialOperationAdd
Application.Calculation = xlCalculationAutomatic
Job = ActiveCell
ActiveCell.Offset(0, 1) = WorksheetFunction.VLookup(Job, range("D:Z"),
3, False)
ActiveCell.Offset(0, 2) = WorksheetFunction.VLookup(Job, range("D:Z"),
6, False)
ActiveCell.Offset(0, 3) = WorksheetFunction.VLookup(Job, range("D:Z"),
14, False)
ActiveCell.Offset(0, 4) = WorksheetFunction.VLookup(Job, range("D:Z"),
2, False)
ActiveCell.Offset(0, 8) = WorksheetFunction.VLookup(Job, range("D:Z"),
23, False)
ActiveCell.Offset(0, 12) = WorksheetFunction.VLookup(Job, range("D:Z"),
9, False)
Sheets("Download").Activate
ActiveCell.Offset(1, -1).Activate
Set FoundCell = Worksheets("Download").Columns("C").FindNext
Loop
End Sub
Thanks!
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
Copying from one TAB to another based on certain criteria Thomas New Users to Excel 1 February 14th 09 01:34 AM
Copying rows with specific criteria Secret Squirrel Excel Discussion (Misc queries) 2 July 27th 08 08:22 AM
Copying rows depending on criteria set? forevertrying Excel Discussion (Misc queries) 2 April 14th 08 03:00 PM
Copying data from one worksheet to another based on criteria Caatt Excel Discussion (Misc queries) 1 June 15th 06 10:19 AM
Copying matched criteria plus relevant columns to new worksheet mattguerilla Excel Discussion (Misc queries) 3 July 29th 05 03:38 PM


All times are GMT +1. The time now is 06:52 AM.

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

About Us

"It's about Microsoft Excel"