LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default variable range

Hi
Does anyone know how to put a variable into a range?

The range is a list in column A which is refreshed when
the workbook is opened.
This list is then loaded into a combobox on a form.

using the range notation
Range("x:y")
x is a constant of A2
and y is the variable mylastcell which has a maximum value
of A138 ie range("A2:A138")

However I only want to display the cells that have
something in them in the combobox, in order not to have
blank spaces at the bottom.

I'm able to return the address of the last cell with
something in it by using
mylastcell = Range("A2").End(xlDown).Address
(ROWABSOLUTE:=False)

However, having obtained a value for mylastcell, I'm
unable to put it into range notation
eg range("A2:mylastcell")

I need your help!
 
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
Use Sum() with variable range Jeff Excel Worksheet Functions 4 April 7th 09 05:26 AM
Variable Range James C. Excel Discussion (Misc queries) 3 April 2nd 09 12:41 AM
variable range John New Users to Excel 2 July 21st 06 03:42 PM
Variable Range sep1280 Excel Worksheet Functions 3 March 6th 06 07:17 AM
Variable range in VB famdamly Excel Discussion (Misc queries) 2 January 22nd 06 02:29 PM


All times are GMT +1. The time now is 04:53 PM.

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

About Us

"It's about Microsoft Excel"