Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referring to multiple ranges

I want to refer to multiple ranges, but I do not want to refer directly to
the cell address since these change all the time. Instead I want to refer to
the cells by using an expression like variable.Address or something like
that. Normally when refering to multiple ranges you simply write like this:
Range("C5:D9,G9:H16,B14:D18"). However when I try to write like that but
using the indirect reference my program does not understand.
My code is:
ActiveChart.SetSourceData
Source:=Sheets("Indata").Range("rng1.Address:rng1. Offset(1, 0).Address,
rng2.Address:rng2.Offset(3,0).Address")

Please help me on this one!! I have tried everything but I still dont get it
!! Please, please help me!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Referring to multiple ranges

Stendahl,

You have the right idea, but needed some tweeking. Since rng1 and rng2 are
variable ranges in VBA and not a range name in Excel, you need to have them
outside the "". Try the following:

=Sheets("Indata").Range(rng1.Address & ":" & rng1.Offset(1, 0).Address & ","
& rng2.Address & ":" & rng2.Offset(3, 0).Address)


Mike

"stendahl_jones" wrote:

I want to refer to multiple ranges, but I do not want to refer directly to
the cell address since these change all the time. Instead I want to refer to
the cells by using an expression like variable.Address or something like
that. Normally when refering to multiple ranges you simply write like this:
Range("C5:D9,G9:H16,B14:D18"). However when I try to write like that but
using the indirect reference my program does not understand.
My code is:
ActiveChart.SetSourceData
Source:=Sheets("Indata").Range("rng1.Address:rng1. Offset(1, 0).Address,
rng2.Address:rng2.Offset(3,0).Address")

Please help me on this one!! I have tried everything but I still dont get it
!! Please, please help me!!

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
Referring to Ranges in Change-Event Macro? Wuddus Excel Discussion (Misc queries) 4 August 24th 07 08:12 PM
Referring to named ranges in a macro Pontificateur Excel Programming 5 September 16th 05 06:23 PM
Referring to named ranges Hardy[_10_] Excel Programming 4 August 25th 05 12:08 PM
Totalling by referring to 2 date ranges Mike Excel Discussion (Misc queries) 2 March 30th 05 01:59 AM
Totalling by referring to 2 date ranges Mike Excel Discussion (Misc queries) 0 March 29th 05 11:57 PM


All times are GMT +1. The time now is 09:06 AM.

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"