Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default vba: attach a variable name to a selected range

I would like to attach a variable name to a range. Is this possible? And if
so, what do I 'Dim' this variable as (string, integer, etc)?

I need to reuse the range when I run a macro which places a formula into a
cell. I want the macro to place a dsum formula into a cell, but since the
range will always be changing, I need to attach a variable to it.

This does not work:

Dim work_items as String
Sheets("work items").Select
work_items = Range("a1:z6000").Value

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default vba: attach a variable name to a selected range



set work_items = Sheets("work items").Range("a1:z6000").Value


"Jayne22" wrote:

I would like to attach a variable name to a range. Is this possible? And if
so, what do I 'Dim' this variable as (string, integer, etc)?

I need to reuse the range when I run a macro which places a formula into a
cell. I want the macro to place a dsum formula into a cell, but since the
range will always be changing, I need to attach a variable to it.

This does not work:

Dim work_items as String
Sheets("work items").Select
work_items = Range("a1:z6000").Value

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default vba: attach a variable name to a selected range

You might try using a variable named range - check out Contextures:
http://www.contextures.com/xlNames02.html

Cliff Edwards
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default vba: attach a variable name to a selected range

awesome! thanks for the help!

"ward376" wrote:

You might try using a variable named range - check out Contextures:
http://www.contextures.com/xlNames02.html

Cliff Edwards

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
Used to be able to attach range of labels to xy coordinates - no m 2007 Excels sucks99999[_2_] Charts and Charting in Excel 1 October 24th 09 11:06 AM
Naming variable range selected by cursor movement Merritt Sakata[_2_] Excel Programming 2 May 29th 08 10:56 AM
how to test whether selected variable is within defined range Abhinandan Excel Programming 0 May 26th 08 08:40 PM
How dio I attach a variable to an Operator:= ? Richard Buttrey Excel Programming 3 October 29th 05 10:35 AM
How do you get a Selected Range address into a variable? Jack Excel Programming 5 November 20th 03 04:09 AM


All times are GMT +1. The time now is 10:56 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"