Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Parsing Last Character in variable length text field Traci Excel Worksheet Functions 3 October 4th 07 04:11 PM
String parsing with variable lenght strings frosterrj Excel Worksheet Functions 10 March 31st 06 11:46 PM
Variable data range help low98 Charts and Charting in Excel 3 January 11th 06 06:46 AM
Set Data Range by Variable MJSlattery Excel Discussion (Misc queries) 4 June 10th 05 07:48 AM
Parsing data - variable length cells Karen[_11_] Excel Programming 2 January 8th 04 11:19 PM


All times are GMT +1. The time now is 07:38 AM.

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"