Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 29, 11:12 am, AKphidelt
wrote: I just threw this together. Try it out, mess with it for your needs. Sub test() Dim sht1 As Worksheet, sht2 As Worksheet, sht3 As Worksheet Dim cnt1 As Integer, x As Integer Set sht1 = Worksheets("Agents") Set sht2 = Worksheets("Production") Set sht3 = Worksheets("Count") sht1.Activate cnt1 = sht1.Range(Range("B1"), Range("B1").End(xlDown)).Count Range("B1").Activate For x = 1 To cnt1 If sht1.Range("B1").Offset(x, 0).Value = sht2.Range("B1").Offset(x, 0).Value Then sht1.Range("B1").Offset(x, 13).Copy sht3.Range("B65536").End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues) End If Next x End Sub Okay, maybe I just don't understand the code, but this doesn't seem to copy the value from sheet Production to sheet Count in the row on Production that matches a value on Agents. I have Agent numbers on the Agent sheet in column B. I have production reporting on the Production sheet. The column with the agent numbers here is also B. The column with the policy count in which I'm interested varies (unfortunately), but I could manually paste it into column C. I want this code to match values from column B of Agent to column B of Production. When the matching row is located, I want it to copy the value from that row of column C of Production to sheet Count (column A would be fine). |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare two wk sheets with common data using copy paste macro | Excel Worksheet Functions | |||
how to compare two columns on two sheets and copy associated data from one sheet to the other? | Excel Programming | |||
how to compare two columns on two sheets and copy associated data from one sheet to the other? | Excel Worksheet Functions | |||
Compare two Sheets and copy value | Excel Worksheet Functions | |||
compare data in two lists to find matching entries | Excel Discussion (Misc queries) |