+ Reply to Thread
Results 1 to 2 of 2

multiple range reference

  1. #1
    Mark J Kubicki
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1