Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying and Pasting Using Row Counts
I have 2 lists A and B. List A has 50 items and List B has 100 items. Each
list has 3 columns of data. I need to copy the first line of data from List A and paste into into a new worksheet 100 times (the length of List B) and then copy List B and paste it next to it to create a List C. I then need to copy the second line of data from List A and paste it below List C again 100 times (the lenght of List B) and again, copy List B and paste it next to it (thus creatiing a List C that is now 200 rows). And repeat this 50 times (the number of rows of data in List A). I understand macros, and I know I can use a Loop using ROWS(), but can't get it quite right. Please Help !!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying and Pasting Using Row Counts
Hi, Stubbsy
list A in sheet 1, list B in sheet 2 and list C in sheet 3, with a blank sheet 3 already existing: Dim lng As Long For lng = 1 To 50 With ThisWorkbook .Sheets(1).Range(.Sheets(1).Cells(lng, 1), .Sheets(1).Cells(lng, 3)) _ .Copy Destination:=.Sheets(3).Range(.Sheets(3) _ .Cells(lng * 100 - 99, 1), .Sheets(3).Cells(lng * 100, 3)) .Sheets(2).Range(.Sheets(2).Cells(1, 1), .Sheets(2).Cells(100, 3)) _ .Copy Destination:=.Sheets(3).Range(.Sheets(3) _ .Cells(lng * 100 - 99, 4), .Sheets(3).Cells(lng * 100, 6)) End With Next 'lng Regards Ingolf Stubbsy. schrieb: I have 2 lists A and B. List A has 50 items and List B has 100 items. Each list has 3 columns of data. I need to copy the first line of data from List A and paste into into a new worksheet 100 times (the length of List B) and then copy List B and paste it next to it to create a List C. I then need to copy the second line of data from List A and paste it below List C again 100 times (the lenght of List B) and again, copy List B and paste it next to it (thus creatiing a List C that is now 200 rows). And repeat this 50 times (the number of rows of data in List A). I understand macros, and I know I can use a Loop using ROWS(), but can't get it quite right. Please Help !!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying and Pasting Using Row Counts
I may be able to help you with this, but I need to know a few things about
your data. Where are lists A & B located? Are they both on sheet1? What range do they occupy? Are there headers? Are the lists always going to be 50 & 100 rows long or can they vary in length? Does the "new worksheet" already exist or do you want it added if it does not exist? If there are headers do want them copied to the first row only of the "new worksheet"? Mike F "Stubbsy." wrote in message ... I have 2 lists A and B. List A has 50 items and List B has 100 items. Each list has 3 columns of data. I need to copy the first line of data from List A and paste into into a new worksheet 100 times (the length of List B) and then copy List B and paste it next to it to create a List C. I then need to copy the second line of data from List A and paste it below List C again 100 times (the lenght of List B) and again, copy List B and paste it next to it (thus creatiing a List C that is now 200 rows). And repeat this 50 times (the number of rows of data in List A). I understand macros, and I know I can use a Loop using ROWS(), but can't get it quite right. Please Help !!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
average daily counts to weekly counts | Excel Discussion (Misc queries) | |||
Copying and Pasting | Excel Discussion (Misc queries) | |||
Copying and pasting ??? | Excel Discussion (Misc queries) | |||
Copying and Pasting | Excel Discussion (Misc queries) | |||
Copying and Pasting | Excel Programming |