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

??? (wrong number of arguments or invalid property assignment)
if user has selected a cell in any of these (3) ranges... do this...

Dim rngTimeEntry As Range
Dim rngProjectTotalHours As Range
Dim rngDateTotalHours As Range

rngTimeEntry = "E6:R" & ActiveSheet.Range("totalcellref").Row - 1
rngProjectTotalHours = "U6:U" & ...
rngDateTotalHours = "E" & CStr(ActiveSheet.Range("total...

If Not Intersect(Target, Range(rngTimeEntry, rngProjectTotalHours,
rngDateTotalHours)) _
Is Nothing Then
...
End If



-------------------
THANKS IN ADVANCE, Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default multiple range reference

But you're not treating those 3 variables as ranges.

You're treating them as strings--they hold the addresses of ranges.

You could continue to treat them as strings:

Dim rngTimeEntryAddr as string
dim rngProjectTotalHoursAddr as string
dim rngDateTotalHoursAddr as string

rngtimeentryaddr = "e6:r" & ActiveSheet.Range("totalcellref").Row - 1
'etc...

if not intersect(target, union(range(rngtimeentryaddr), _
range(rngprojecttotalhoursaddr), _
range(rngdatetotalhoursaddr)) is nothing then

....

Or you could treat them as range objects:

Dim rngTimeEntry As Range
Dim rngProjectTotalHours As Range
Dim rngDateTotalHours As Range

with activesheet
set rngTimeEntry =.range("E6:R" & .Range("totalcellref").Row - 1)
set rngProjectTotalHours = .range("U6:U" & ...)
set rngDateTotalHours = .range("E" & CStr(.Range("total...))

If Not Intersect(Target, _
union(rngTimeEntry, rngProjectTotalHours, rngDateTotalHours)) _
Is Nothing Then
...
End If




Mark J Kubicki wrote:

??? (wrong number of arguments or invalid property assignment)
if user has selected a cell in any of these (3) ranges... do this...

Dim rngTimeEntry As Range
Dim rngProjectTotalHours As Range
Dim rngDateTotalHours As Range

rngTimeEntry = "E6:R" & ActiveSheet.Range("totalcellref").Row - 1
rngProjectTotalHours = "U6:U" & ...
rngDateTotalHours = "E" & CStr(ActiveSheet.Range("total...

If Not Intersect(Target, Range(rngTimeEntry, rngProjectTotalHours,
rngDateTotalHours)) _
Is Nothing Then
...
End If

-------------------
THANKS IN ADVANCE, Mark


--

Dave Peterson
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
Excel 2007 formula, multiple reference range Lisa Grant Excel Discussion (Misc queries) 0 January 25th 10 11:01 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Reference the worksheet from a multiple worksheet range function ( DBickel Excel Worksheet Functions 1 May 28th 05 03:49 AM
adding reference-to-range control to excel range Nir Sfez Excel Programming 1 March 2nd 04 06:11 PM
Subscript out of Range on Range reference Tom Ogilvy Excel Programming 0 September 13th 03 03:38 PM


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