Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
copy from B worksheet to A worksheet with NO repeated data tikchye_oldLearner57 Excel Discussion (Misc queries) 1 September 29th 06 06:56 PM
copy data in a cell from worksheet A to worksheet B rajesh Excel Discussion (Misc queries) 1 February 21st 06 07:40 AM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
Copy Modified Worksheet 1 Data to Worksheet 2 clarkelrc Excel Programming 0 April 15th 04 01:36 PM
copy all worksheet data into a new worksheet eric Excel Programming 2 October 2nd 03 08:33 PM


All times are GMT +1. The time now is 06:40 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"