+ Reply to Thread
Results 1 to 2 of 2

pull only one line of similar text it finds in column, and returns it to the first cell on

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    phoenix
    MS-Off Ver
    Excel 2007
    Posts
    31

    pull only one line of similar text it finds in column, and returns it to the first cell on

    I am trying to pull two cells from one page into a summary type sheet. One of the two cells will pull only one line of similar text it finds in column, and returns it to the first cell on summary sheet, then it finds the next line of text that is different and placing it on summary sheet. Then it finds the designation to one of those rows of text and returns it to the corresponding cell.

    EXAMPLE:

    Plumbing Data Input (Tab)
    Cell G8 is first cell in column which can run down to 1,000.
    This cell uses a Data Validation pull down to select a fixture type (heading of column) which will then populate 3 other cells (to the right) with fixture units for a calculation.

    Cell H8:H1000 will require me to input a designation for that type of fixture and a quantity in the next cell as I go down column and input data.

    Plumbing Design (Tab)
    Cell B9 I am trying to do a macro to pull only one fixture type at a time (and only one of that type from Plumbing Data Input tab) and place it in the first cell B9. From here cell E9 needs to be populated with the corresponding fixture designation that was given to that fixture type. So I may have 30 - "F.V. Water Closets (1.6 gpm)" and a designation of "WC-1" and another 20 fixtures of "ADA F.V. Water Closet (1.6 gpm)" and a designation of "WC-2". All of the 30 WC-1 fixtures are input in 30 cells and the 20 WC-2 fixtures are in another 20 differnet cells. There are a lot of different fixtures that will be in this input tab, but I only want to pul one similar one from all of those and place it in cell.

    Here is the Macro I was trying to use, but fails to return anything. Again I am very green when it comes to Macros.

    Sub SortData()
    Dim rg As Range, c As Range, i As Integer, SL As Object

    Set rg = Sheets("Plumbing Data Input").Range("G8:G:1000") '<< adapt range here
    With CreateObject("System.Collections.SortedList")
    For Each c In rg
    If c <> "" Then .Item(c.Value) = c.Value
    Next c
    For i = 1 To .Count - 1
    Sheets("Plumbing Design").Range("B" & i + 9) = .getbyindex(i)
    Next i
    End With
    End Sub



    Thanks
    J
    Attached Files Attached Files
    Last edited by jgregory43; 08-22-2013 at 12:05 PM.

  2. #2
    Registered User
    Join Date
    10-02-2012
    Location
    phoenix
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: pull only one line of similar text it finds in column, and returns it to the first cel

    OK I figured out where my code was flawed. I had a spce on my tab I did not notice. I removed it, and it worked somewhat. I do get a result but not a complete result.
    I won't return all the items in the range for some reason. The c.value does not seem to function correctly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] need formula that finds phone #, if true, returns empty cell
    By jessexcel in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-23-2013, 11:44 PM
  2. Replies: 1
    Last Post: 02-01-2013, 06:30 PM
  3. [SOLVED] Lookup that returns true value if cell matches text in a column
    By shauncat in forum Excel General
    Replies: 5
    Last Post: 07-16-2012, 10:30 PM
  4. Modification required in the code line which finds the Last column
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2008, 03:54 PM
  5. [SOLVED] Vlookup finds a blank, but returns a zero - HELP!
    By flummoxed in forum Excel General
    Replies: 6
    Last Post: 01-18-2005, 12:06 PM

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