+ Reply to Thread
Results 1 to 11 of 11

Macro to select cells

  1. #1
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Macro to select cells

    Hello All,

    I am trying to write a Macro that will automatically select a range of cells. The macro I am using is as follows:

    Please Login or Register  to view this content.
    In my particular worksheet the value "Period" is on cell C3. So the Macro should select cells C4:T4. However when I run the Macro it actuall selects cells B4:T4

    Does anybody know what the mistake in this code is?
    Last edited by floridagunner; 04-25-2011 at 06:09 PM.

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to select cells

    Get rid of the "(Offset(0, -1)"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Re: Macro to select cells

    Hello Whizbang,

    I just used your code, with the "(Offset(0, -1)" ommitted. However now the macro is selecting the cells C4:U4, when I need it to select C4:T4, which is one column less than the last column with data.

    Hope I'm being clear.
    Last edited by floridagunner; 04-25-2011 at 05:04 PM. Reason: ommitted a word

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Macro to select cells

    Maybe upload a sample sheet ;-)

  5. #5
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Re: Macro to select cells

    How do I upload a sample spreadsheet? I don't see an attachment button.

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Macro to select cells

    click "Go Advanced" then scroll down to "Manage Attachments" command button

  7. #7
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Re: Macro to select cells

    Ok Sample Speadsheet now added.

  8. #8
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to select cells

    Try this.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Re: Macro to select cells

    Hello Whizbang,

    That code did not work as it selected everything to the right of cell C4 including cell C4. The actual cells selected were C4:IU4.

    What I need it do is select cells C4:T4, and not the Grand Total column or anything to the right of the Grand Total column.
    Last edited by floridagunner; 04-25-2011 at 05:25 PM. Reason: Clarification

  10. #10
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Macro to select cells

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    07-13-2007
    Posts
    50

    Re: Macro to select cells

    Thank you Nimrod, it worked!!!!

+ 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