Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 8 Jun, 13:58, BCLivell wrote:
I need some assistence to come up with come code that will copy a range of cells from a single column. The text in the first cell and the last cell are always the same. But sometimes there could be 5 cells inbetween and other times there could be 100 cells inbetween. Below is what I ahve come up with to so far to show where I am trying to go. Thank you for your help!! startrow = Columns(2).Find("start example 1").Select ActiveCell.Copy ******Need to also copy all cells inbetween here**** startrow = Columns(2).Find("end example 1").Select ActiveCell.Copy How will the range be populated? If it is by the insertion of rows then you could name the range in the worksheet and just copy it, regardless of how many rows are added. Alternatively, do something like this: Dim rngCopyRange As Range Dim lngStartRow As Long Dim lngEndRow As Long lngStartRow = Columns(2).Find("start example 1").Row lngEndRow = Columns(2).Find("end example 1").Row Set rngCopyRange = Range("B" & lngStartRow & ":B" & lngEndRow) rngCopyRange.Copy -- juux |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vary the Range in a Function | Excel Worksheet Functions | |||
How do I create a macro that will select a range that can vary in | Excel Discussion (Misc queries) | |||
INDIRECT / Setting to vary a range? | Excel Discussion (Misc queries) | |||
Subtotals in a range that could vary in size | Excel Programming | |||
How can I vary graph color by range value | Charts and Charting in Excel |