ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use memory variable in range selection (https://www.excelbanter.com/excel-programming/436384-use-memory-variable-range-selection.html)

Ron5440

Use memory variable in range selection
 
My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron

Rick Rothstein

Use memory variable in range selection
 
This single line should do what you want...

Range(Range("B12"), ActiveCell).Select

--
Rick (MVP - Excel)


"Ron5440" wrote in message
...
My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find
an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron



Paul C

Use memory variable in range selection
 
take the "" off of the x, they are not needed.

range("B12":x).select


--
If this helps, please remember to click yes.


"Ron5440" wrote:

My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron


Jacob Skaria

Use memory variable in range selection
 
My range always starts at B12 but it varies in depth.
Range("B12", Range("B12").End(xlDown)).Select

After I find the bottom right I need to select to the top left

Range(Range("B12").Offset(, -1), Range("B12").End(xlDown)).Select

If this post helps click Yes
---------------
Jacob Skaria


"Ron5440" wrote:

My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron


Matthew Herbert[_3_]

Use memory variable in range selection
 

Ron,

One method is below. If you want to "smash" string data together, use
CONCATENATE, or & (see below).

Best,

Matthew Herbert

Range("B12",x).Select
Range("B12:" & x).Select

"Ron5440" wrote:

My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron


Jacob Skaria

Use memory variable in range selection
 
Try

Range("b12", ActiveCell).Select

If this post helps click Yes
---------------
Jacob Skaria


"Ron5440" wrote:

My range always starts at B12 but it varies in depth.
After I find the bottom right I need to select to the top left
x = ActiveCell.Address
Range("b12":"x").Select
I did this a couple of years ago in another piece of code but cannot find an
example of it and don't remember how I did it.
I am still searching...if anyone has a quick piece of code it would be
appreciated.

Thnks,
Ron



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

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