+ Reply to Thread
Results 1 to 6 of 6

select range using offset or resize property

  1. #1
    Registered User
    Join Date
    06-21-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    56

    select range using offset or resize property

    Hi!!

    So in my sheet, I have selected column D. And I want to select the next 4 columns (including column D), so that my selection or active cells at that point would be Columns D, E, F, G and H.

    All help is very appreciated! THanks!
    Last edited by longhorn23; 07-06-2010 at 01:08 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: select range using offset property

    I wouldn't recommend the "selecting" process at all, it's 99% unnecessary in VBA. You can define a range and address commands to that range directly.

    But to answer your question. If you have "selected" a column and wish to resize that selection to a total of 5 columns:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-21-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: select range using offset property

    Quote Originally Posted by JBeaucaire View Post
    I wouldn't recommend the "selecting" process at all, it's 99% unnecessary in VBA. You can define a range and address commands to that range directly.

    But to answer your question. If you have "selected" a column and wish to resize that selection to a total of 5 columns:
    Please Login or Register  to view this content.

    Thanks for the reply!

    The way it works is that, I have a listbox which has a few values in it. The code goes into sheet1 and searches for those values and offsets or resizes to the amount of values that are stored in the listbox.

    For example, if I have a 4 values in the listbox with the first value being in Column B. It should select columns B, C, D, and E. (i.e. selecting a total of 4 columns since there are 4 values).

    I think your code is working though. I used the same code, but instead of resize I was using offset.
    Last edited by longhorn23; 07-06-2010 at 01:17 PM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: select range using offset or resize property

    Not sure what you mean. What type of ListBox?

    You might want

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    06-21-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: select range using offset or resize property

    Quote Originally Posted by royUK View Post
    Not sure what you mean. What type of ListBox?

    You might want

    Please Login or Register  to view this content.
    I figured it out. Thanks for hte help!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: select range using offset or resize property

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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