+ Reply to Thread
Results 1 to 4 of 4

Expand selection to add column to the right

  1. #1
    Registered User
    Join Date
    05-05-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    20

    Expand selection to add column to the right

    I know this has to be simple but I can't seem to find it. I have a macro that does other things that I need it to and I am happy with the steps it does. What I need is a step at the begining that expands the selection from the selected column to include that column and the one to the right. The problem is that the column that will be selected originally is not known, it will initially be selected by the user, at which point the macro will be executed. So for example if they select column G and then run the macro, I need it to select column G and column H. I was able to find a command that used offset to move the active selection one column to the right but I need it to also keep the original column selected.
    Last edited by MnMShow; 05-06-2010 at 11:47 AM.

  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: Expand selection to add column to the right

    Hello MnMShow,

    Use the Resize method to expand it.
    Please Login or Register  to view this content.
    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
    05-05-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Expand selection to add column to the right

    Quote Originally Posted by Leith Ross View Post
    Hello MnMShow,

    Use the Resize method to expand it.
    Please Login or Register  to view this content.
    I selected a single column at random and ran this macros and I got "compile error: syntax error" with this. This is the only line of code in my script for testing purposes. Can you double check the syntax?

    Ahh I figured it out. Added the .select to the end of your command and it does precisely what I wanted. Thanks so much for your help and thanks for responding so quickly.
    Last edited by MnMShow; 05-05-2010 at 11:06 PM. Reason: figured it out

  4. #4
    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: Expand selection to add column to the right

    Hello MnMShow,

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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