Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select range between column and row
In a large field of data I have definded a row range.
colAdd is a string = $H$1,$I$1,$J$1,$K$1,$L$1,$M$1 I want to define all the cells down for all columns using something like Selection.End(xlDown) Ive tried severa manipulations Set preSrcRng = Range(colAdd).End(xlDown) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select range between column and row
sorry, the OP was incomplete
In a large field of data I have definded a range from a segment of the top row. colAdd is a string = $H$1,$I$1,$J$1,$K$1,$L$1,$M$1 I want to return all the cells down for all columns using something like Selection.End(xlDown) Ive tried severa manipulations Set preSrcRng = Range(colAdd).End(xlDown) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select range between column and row
sorry, the OP was incomplete
In a large field of data I have definded a range from a segment of the top row. colAdd is a string = $H$1,$I$1,$J$1,$K$1,$L$1,$M$1 I want to return all the cells down for all columns using something like Selection.End(xlDown) Ive tried severa manipulations Set preSrcRng = Range(colAdd).End(xlDown) just returns the last cell in the first column sorry, the OP was incomplete In a large field of data I have definded a range from a segment of the top row. colAdd is a string = $H$1,$I$1,$J$1,$K$1,$L$1,$M$1 I want to return all the cells down for all columns using something like Selection.End(xlDown) Ive tried severa manipulations Set preSrcRng = Range(colAdd).End(xlDown) returns an error 1004 method fail any help will be appreciated |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select range between column and row
Hello Robert H, This method will combine find the end of each column and create a new range with that includes the end of the columns. Code: -------------------- Sub RangeTest() Dim Addx As String Dim NewRng As Range Dim Rng As Range Set Rng = Range("H1,I1,J1,K1,L1,M1") For Each Cell In Rng.Areas If NewRng Is Nothing Then Set NewRng = Range(Cell, Cell.End(xlDown)) Else Set NewRng = Union(NewRng, Range(Cell, Cell.End(xlDown))) End If Next Cell Addx = NewRng.Address End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=44959 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
select a range in a column | Excel Discussion (Misc queries) | |||
Select a range by column number | Excel Programming | |||
Select column same row by range name | Excel Programming | |||
Select a range in a column in currentregion | Excel Programming | |||
select a range base on Column A | Excel Programming |