+ Reply to Thread
Results 1 to 3 of 3

Searching for text and displaying on another sheet...

  1. #1
    Registered User
    Join Date
    01-21-2004
    Location
    Texas
    Posts
    7

    Searching for text and displaying on another sheet...

    I have a workbook that I use for building estimating. It has a number of sheets and the main estimating sheet is called "Estimate". I then have continuation sheets (the first is named "Continuation Pg" and subsequent ones (added as needed) are called "Continuation(2)" "Continuation(3)", etc.

    I need to search the "Estimate" and all "Continuation" sheets for a text string, e.g., "Total Building Damages:" and when it is found, it will be in Col A of one of those sheets. I then need to display the value in Col F of that row in another sheet (named "Report"), in E21. Further, I need to display the value in Col G of the "Estimate" sheet (same row) in G21 of the "Report" worksheet. And so on for other values.


    Since there should be only one occurrence of this text string in the workbook, it would be OK to search the entire workbook for this string.


    Can anyone help me get started? I'm not all that familiar with VBA, but I'm getting lots of good info from the newsgroup and have bought a couple of books.
    Hopefully, I'll start to pick it up.

    TIA,

    Jim

  2. #2
    Registered User
    Join Date
    10-12-2003
    Posts
    34
    sub FindString()
    dim MyString as String
    dim sh as worksheet
    dim cell as range

    On Error Resume Next
    MyString ="Total Building Damages:"
    For each sh in worksheets
    Set cell = Range("A:A").Find(What:=MyString)
    Next sh

    Msgbox "Your string was found in: " & sh.Name & cell.address

    'To get the offset into your report sheet:

    Sheets("Report").Range("Whaterver")=cell.offset(0,6) '6 columns to the right

    end sub

    Hope this helps you get started
    Last edited by gocush; 01-04-2005 at 12:58 AM.
    Paul

  3. #3
    Registered User
    Join Date
    01-21-2004
    Location
    Texas
    Posts
    7

    Thanks, Paul...

    That should get me started just fine. Appreciate your time.


    Jim

+ 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