+ Reply to Thread
Results 1 to 5 of 5

Using Find in macro to select range of a table

  1. #1
    Registered User
    Join Date
    01-13-2010
    Location
    Bakersfield, CA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Using Find in macro to select range of a table

    I am fairly new to macros, but have been programming with formulas for years,

    Using RecordMacro, I am trying to find a table of text, and copy it to another worksheet. I want to copy it as a range, not as rows or columns. Using Find, I can get to the 1st row of the table. Using Find again, I can get to the last row of the table.

    What I don’t know how to do next is select the range.

    For example; The table is in cells A10:F20. “Start” is in cell A10, and “End” is in cell A20.

    Starting from cell A1, how do I find and select the range A10:F20.?

    I will be doing this twice in the same macro, as there are 2 tables. Each of the 2 tables has the same “Start” and “End” text, as described above. The 2 tables will not always be located in the same location within the original WkSht.

    Thx
    BHudPE

  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: Using Find in macro to select range of a table

    Hello BHudPE,

    If you have found the starting cell and last cell, set a range object equal to these.
    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
    01-13-2010
    Location
    Bakersfield, CA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Using Find in macro to select range of a table

    Ok Thx, I haven't used that yet.

    Can the ("A10", "F20") be set by the Find results within the Macro?

  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: Using Find in macro to select range of a table

    Hello BHudPE,

    Yes, you can it use Find to return the start and end of the range. The VBA Find Method returns a Range Object. You would need to change the code a little if you use that method.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-13-2010
    Location
    Bakersfield, CA
    MS-Off Ver
    Excel 2003
    Posts
    37

    [SOLVED] Re: Using Find in macro to select range of a table

    Thank you, I was able to figure it out

+ 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