Closed Thread
Results 1 to 2 of 2

select dynamic range with dynamic start point

  1. #1
    Juli
    Guest

    select dynamic range with dynamic start point

    I need to select a dynamic range (known number of columns, unknown number of
    rows), where the starting row always changes, and paste it to another workbook

    I'm always able to determine the starting cell of the range by searching
    (FIND) for the heading in the report and offsetting by 1 row. I know that
    the data should be in columns A through F, with a dynamic number of rows.
    So, at first I just used some simple code to select the range:
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select

    This worked fine until a report came back with no data under the report
    heading. The above code caused me to have too many columns to paste in the
    other workbook. The number of rows were okay because of the heading for the
    next section of the report stopped the .End(xlDown)

    Any ideas on how to select the range or if the section is blank how do I
    skip this part of the macro?

    THANKS!

  2. #2
    Tushar Mehta
    Guest

    Re: select dynamic range with dynamic start point

    You should be able to adapt the code in

    http://groups.google.com/group/micro...gramming/brows
    e_frm/thread/53226b7070f4830/f3453a06daf7c62c

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <4042F4CE-9ECD-4330-AE49-523B9792881D@microsoft.com>,
    Juli@discussions.microsoft.com says...
    > I need to select a dynamic range (known number of columns, unknown number of
    > rows), where the starting row always changes, and paste it to another workbook
    >
    > I'm always able to determine the starting cell of the range by searching
    > (FIND) for the heading in the report and offsetting by 1 row. I know that
    > the data should be in columns A through F, with a dynamic number of rows.
    > So, at first I just used some simple code to select the range:
    > Range(Selection, Selection.End(xlToRight)).Select
    > Range(Selection, Selection.End(xlDown)).Select
    >
    > This worked fine until a report came back with no data under the report
    > heading. The above code caused me to have too many columns to paste in the
    > other workbook. The number of rows were okay because of the heading for the
    > next section of the report stopped the .End(xlDown)
    >
    > Any ideas on how to select the range or if the section is blank how do I
    > skip this part of the macro?
    >
    > THANKS!
    >


Closed 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