+ Reply to Thread
Results 1 to 8 of 8

Relative code vs absolute code

  1. #1
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Relative code vs absolute code

    can someone tell me how to re-write the following code? I believe it would be the equivalent of ctrl + A where you are selecting the entire database. I want a relative reference instead of an absolute because the worksheets will be different sizes.


    Please Login or Register  to view this content.
    Last edited by dalewms2; 09-22-2011 at 03:36 PM.

  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: Relative code vs absolute code

    Hello dalewms2,

    I don't understand your question. Do you want to automatically size the worksheet based on the cells that conatin data?
    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
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Relative code vs absolute code

    Hi dalewms2
    Do you mean?
    Please Login or Register  to view this content.

  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: Relative code vs absolute code

    Hello Barry,

    The UsedRange will include cells formatted with borders, colors, and patterns which may extend beyond the cells with data.

  5. #5
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Relative code vs absolute code

    I got a Run-time error '438' with the command.

  6. #6
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Relative code vs absolute code

    Assuming the data has no gaps, perhaps you want the current region?

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

    Colin

    RAD Excel Blog

  7. #7
    Forum Contributor
    Join Date
    08-08-2011
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Relative code vs absolute code

    That did it!! thanks so much!!

  8. #8
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Relative code vs absolute code

    Thank you too both Colin and Leith

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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