+ Reply to Thread
Results 1 to 3 of 3

Setting a Range with only 1 row of data?

  1. #1
    Registered User
    Join Date
    01-15-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    24

    Setting a Range with only 1 row of data?

    Hello,

    I have a vba process which searches for ranges of data within an excel sheet. The following action works very well when more than 1 row of data exists in the range.

    Please Login or Register  to view this content.
    However, if only 1 row of data exists and I use this action, it will select all of the rows below the first row. Most of the times--it will go to the last row (1048576). Do you have any suggestions for resolving this?

    intRow is a variable which identifies the row where my range of data begins. The rang of data always starts within the first column.

    Many thanks,
    J

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Setting a Range with only 1 row of data?

    If you have at least one row of data, then
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    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: Setting a Range with only 1 row of data?

    Hello gnome_core,

    If you still want to use the Resize method, you can by changing your code to what is below..
    Please Login or Register  to view this content.
    The Resize method takes 2 arguments: Rowsize and Columnsize. If the argument is left out then the default is the current number of rows or columns in the range. In your original post, the Rowsize is absent. In the code above it is set to 1. Your range will be 1 row by 3 columns wide.
    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!)

+ 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