ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using macro/vba to copy varying ranges of rows (https://www.excelbanter.com/excel-discussion-misc-queries/145204-using-macro-vba-copy-varying-ranges-rows.html)

BCLivell

Using macro/vba to copy varying ranges of rows
 
Hi Everyone-

I am trying to come up with a vba script to copy a set of rows that can
change. The first and last row (in terms of content) will always be the
same. but the rows inbetween would/could change. I need the macro to start
copying a row where it finds a particular cell (based on what is in the cell)
and stop copying down rows once it finds another cell (based on what is in
the cell) For example:

Ex1: A set of rows that are 10 rows long. Cell b15 says "start example 1"
and cell b25 says "end example 1" A person adds 2 rows above the orginial
b15 and adds 5 rows inbetween the orginal B15 and B25. So now, "start
example 1" cell is on B17 and "end example 1" is on B32.

Thank you for any help/suggesstions you might have!!!

Don Guillett

Using macro/vba to copy varying ranges of rows
 
Have a look in the vba help index for FIND
startrow=columns(2).find(etc

--
Don Guillett
SalesAid Software

"BCLivell" wrote in message
...
Hi Everyone-

I am trying to come up with a vba script to copy a set of rows that can
change. The first and last row (in terms of content) will always be the
same. but the rows inbetween would/could change. I need the macro to
start
copying a row where it finds a particular cell (based on what is in the
cell)
and stop copying down rows once it finds another cell (based on what is
in
the cell) For example:

Ex1: A set of rows that are 10 rows long. Cell b15 says "start example 1"
and cell b25 says "end example 1" A person adds 2 rows above the orginial
b15 and adds 5 rows inbetween the orginal B15 and B25. So now, "start
example 1" cell is on B17 and "end example 1" is on B32.

Thank you for any help/suggesstions you might have!!!



BCLivell

Using macro/vba to copy varying ranges of rows
 
Thank you for the suggestion. I am still unclear though on how to get the
code to automaticaly cut/copy the rows inbetween the two rows that I want it
to look for. Thank you!

"Don Guillett" wrote:

Have a look in the vba help index for FIND
startrow=columns(2).find(etc

--
Don Guillett
SalesAid Software

"BCLivell" wrote in message
...
Hi Everyone-

I am trying to come up with a vba script to copy a set of rows that can
change. The first and last row (in terms of content) will always be the
same. but the rows inbetween would/could change. I need the macro to
start
copying a row where it finds a particular cell (based on what is in the
cell)
and stop copying down rows once it finds another cell (based on what is
in
the cell) For example:

Ex1: A set of rows that are 10 rows long. Cell b15 says "start example 1"
and cell b25 says "end example 1" A person adds 2 rows above the orginial
b15 and adds 5 rows inbetween the orginal B15 and B25. So now, "start
example 1" cell is on B17 and "end example 1" is on B32.

Thank you for any help/suggesstions you might have!!!




Don Guillett

Using macro/vba to copy varying ranges of rows
 
I'm still not quite sure what you want but this is the idea. If you still
can't figure it out send me a wb with DETAILED instructions of what you
want.


Just find the start and the end rows and use that
startrow=columns(2).find(value1).row
stoprow=
go from there.

--
Don Guillett
SalesAid Software

"BCLivell" wrote in message
...
Thank you for the suggestion. I am still unclear though on how to get the
code to automaticaly cut/copy the rows inbetween the two rows that I want
it
to look for. Thank you!

"Don Guillett" wrote:

Have a look in the vba help index for FIND
startrow=columns(2).find(etc

--
Don Guillett
SalesAid Software

"BCLivell" wrote in message
...
Hi Everyone-

I am trying to come up with a vba script to copy a set of rows that can
change. The first and last row (in terms of content) will always be
the
same. but the rows inbetween would/could change. I need the macro to
start
copying a row where it finds a particular cell (based on what is in the
cell)
and stop copying down rows once it finds another cell (based on what
is
in
the cell) For example:

Ex1: A set of rows that are 10 rows long. Cell b15 says "start example
1"
and cell b25 says "end example 1" A person adds 2 rows above the
orginial
b15 and adds 5 rows inbetween the orginal B15 and B25. So now, "start
example 1" cell is on B17 and "end example 1" is on B32.

Thank you for any help/suggesstions you might have!!!






All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com