Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Data From Worksheet to Another Worksheet
I would like a Excel VBA script to copy the data from Worksheet T1 to Worksheet T2. Columns A and B uniquely identify the records for Worksheet T1 and Worksheet T2. I would like the script to populate Column K,L,M,and N from Worksheet T2 the using the Columns C,D,E and F from Worksheet T1. Please help me create this script. Thanks, Worksheet T1 Column A Column B Column C Column D Column E Column F 123 TENN 647 2389 IN 879 238 DALL 348 7148 OUT 1224 624 DENV 786 8909 IN 6478 Worksheet T2 Column A Column B Column K Column L Column M Column N 624 DENV 123 TENN 238 DALL Desired Output: Worksheet T2 Column A Column B Column C Column D Column E Column F 624 DENV 786 8909 IN 6478 123 TENN 647 2389 IN 879 238 DALL 348 7148 OUT 1224 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Data From Worksheet to Another Worksheet
Try this code. I think you final results has the wrong column lettters. The
destination should b columns K,l,m,n Sub Populate_T2() With Sheets("T1") T1RowCount = 1 Do While .Range("A" & T1RowCount) < "" Number = .Range("A" & T1RowCount) City = .Range("B" & T1RowCount) With Sheets("T2") T2RowCount = 1 Do While .Range("A" & T2RowCount) < "" If (Number = .Range("A" & T2RowCount)) And _ (City = .Range("B" & T2RowCount)) Then Sheets("T1").Range("C" & T1RowCount & ":F" & _ T1RowCount).Copy Destination:=.Range("K" & T2RowCount) Exit Do End If T2RowCount = T2RowCount + 1 Loop End With T1RowCount = T1RowCount + 1 Loop End With "Joe K." wrote: I would like a Excel VBA script to copy the data from Worksheet T1 to Worksheet T2. Columns A and B uniquely identify the records for Worksheet T1 and Worksheet T2. I would like the script to populate Column K,L,M,and N from Worksheet T2 the using the Columns C,D,E and F from Worksheet T1. Please help me create this script. Thanks, Worksheet T1 Column A Column B Column C Column D Column E Column F 123 TENN 647 2389 IN 879 238 DALL 348 7148 OUT 1224 624 DENV 786 8909 IN 6478 Worksheet T2 Column A Column B Column K Column L Column M Column N 624 DENV 123 TENN 238 DALL Desired Output: Worksheet T2 Column A Column B Column C Column D Column E Column F 624 DENV 786 8909 IN 6478 123 TENN 647 2389 IN 879 238 DALL 348 7148 OUT 1224 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy from B worksheet to A worksheet with NO repeated data | Excel Discussion (Misc queries) | |||
copy data in a cell from worksheet A to worksheet B | Excel Discussion (Misc queries) | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming | |||
Copy Modified Worksheet 1 Data to Worksheet 2 | Excel Programming | |||
copy all worksheet data into a new worksheet | Excel Programming |