Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

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
Change InputBox Range Selection to Column Letter Selection intoit Excel Programming 2 July 21st 09 07:58 AM
public variable declaration, memory efficient? slarbie Excel Programming 2 April 6th 09 03:56 PM
Store Current Selection As Range Variable. Bob Phillips Excel Programming 0 February 20th 08 05:35 PM
Range Address Memory Variable Limitation MSweetG222 Excel Programming 4 December 12th 05 06:35 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"