+ Reply to Thread
Results 1 to 4 of 4

AboutRangeSelection

  1. #1
    Registered User
    Join Date
    07-21-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2019
    Posts
    13

    Smile AboutRangeSelection

    A question regarding "AboutRangeSelection" procedure on Chapter 11 in the CD, Excel 2003 Power Programming with VBA by John Walkenbach.

    Please Login or Register  to view this content.
    I am quite puzzled about the above statement. Lets say the my range selection are: A3, B2:D5.
    Then FirstAreaType= Cell from the AreaType function and same for WhatSelected.
    Set UnionRange = A3
    CurrentType = Cell

    No execution of this statement : If CurrentType = "Block" Then NumBlocks = NumBlocks + 1
    because CurrentType is a Cell

    Wouldn't Set UnionRange becomes a range that unifies A3 and A3? I think that I just didn't understand what the Area in Union(UnionRange, Area) represents?

    And let say the next range is processed: B2:D5
    Then we have
    CurrentType is Block, So NumBlocks= 1
    Set UnionRange = UnionRange(A3, B2:D5) ? (1st Question)

    I understand that A3 is cell and B2:D5 is block and althought they are different types of range, we can have a collection of ranges that contains those two types of range in the UnionRange.

    (2nd Question)
    How can i display the arguments in UnionRange right after Set UnionRange = Union(UnionRange, Area)

    Could you please help? Thank you in advanced.
    Last edited by Leith Ross; 07-22-2009 at 01:45 AM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: AboutRangeSelection

    Hello curiousGrace,

    Welcome to the Forum!

    I am going to keep this simple and not address anything other than what the statement below does.
    Please Login or Register  to view this content.
    The object variable "UnionRange" will be a Range Object that contains the both ranges of "UnionRange" and "Area", both of which are Range Objects themselves.

    Let's look at the what is happening using your example.
    Please Login or Register  to view this content.
    In the first statement, UnionRange is initially set to Range("A3") of the active worksheet. The second statement reassigns UnionRange to contain both the initial range, Range("D3"), and the Range("B2:D5"). If we check the address of UnionRange it would like this "D3, B2:D5".
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-21-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2019
    Posts
    13

    Smile Re: AboutRangeSelection

    Thank you very much for answering my question.

    Sincerely,
    curiousGrace

  4. #4
    Registered User
    Join Date
    07-21-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2019
    Posts
    13

    Re: AboutRangeSelection

    just a silly question. since registration is free, who or how are these forums and sites funded? thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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