none
Change Cell Reference withing Range RRS feed

  • Question

  • Put simply, I have 

    Dim myRange As Range
    Set myRange = Range("A1:A3")

    The user will select if they want all or some of those 3 cells in the range. So if the user only wants A1 and A3, I would like to change the range to:

    Range("A1,A3").

    Or if the user wants A2 and A3, myRange would then equal

    Range("A2,A3").

    How do I do this?

    Thanks,

    Friday, September 14, 2018 7:36 PM

All replies

  • Try the following.

    Dim myRange As Range
    Set myRange = Selection


    Regards, OssieMac

    • Proposed as answer by CHatmaker Friday, September 28, 2018 11:20 AM
    Sunday, September 16, 2018 12:02 AM
  • Hi Gradient,

    Have you tried the OssieMac's solution?  Looking forward to your reply.  

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    Monday, September 17, 2018 10:54 AM
    Moderator
  • Hi Gradient,

    Did you solevd your problem or any updates for this?  If you have any question, or update, please feel free

    to let me know.

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    Friday, September 28, 2018 2:53 AM
    Moderator