Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Parsing Variable Range of Data
I need to be able to parse data from one sheet to another. The
following would be a typical data set (this is just a sample - the actual data set is thousands of lines long). A B C D 5 10 15 20 3 15 10 2 5 10 15 20 3 15 10 2 I want to be able to use a macro to copy a selected range of cells onto another sheet. For example: copy range A1:D1 from sheet #1 to A1:D1 of sheet#2, then increment a number of rows (variable), for this example 2. So now the macro will automatically go to A3:D3 from sheet #1 to A2:D2 of sheet#2. I need to do this until the end of the file (basically increment the copy/paste command by a number until the end of file). Thanks in Advance, Amit |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Parsing Variable Range of Data
With Worksheets("sheet1")
VariableIncr = 2 rw = 2 for i = 1 to .cells(rows.count,1).End(xlup).Row Step VariableIncr .cells(i,1).Resize(1,4).copy destination:=Worksheets("Sheet2") _ .cells(rw,1) rw = rw + 1 Next You could also use a helper column to use a formula to indicate which lines to copy, then use the autofilter to make only those rows visible, then do the copy all at once. -- Regards, Tom Ogilvy "Amit" wrote in message om... I need to be able to parse data from one sheet to another. The following would be a typical data set (this is just a sample - the actual data set is thousands of lines long). A B C D 5 10 15 20 3 15 10 2 5 10 15 20 3 15 10 2 I want to be able to use a macro to copy a selected range of cells onto another sheet. For example: copy range A1:D1 from sheet #1 to A1:D1 of sheet#2, then increment a number of rows (variable), for this example 2. So now the macro will automatically go to A3:D3 from sheet #1 to A2:D2 of sheet#2. I need to do this until the end of the file (basically increment the copy/paste command by a number until the end of file). Thanks in Advance, Amit |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Parsing Last Character in variable length text field | Excel Worksheet Functions | |||
String parsing with variable lenght strings | Excel Worksheet Functions | |||
Variable data range help | Charts and Charting in Excel | |||
Set Data Range by Variable | Excel Discussion (Misc queries) | |||
Parsing data - variable length cells | Excel Programming |