+ Reply to Thread
Results 1 to 6 of 6

search for data

Hybrid View

  1. #1
    Registered User
    Join Date
    06-11-2006
    Posts
    3

    search for data

    hi please look to attached file
    Attached Images Attached Images

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Try this:
    Sub x()
    
    Dim c As Range
    Dim l As Long
    Dim str As String
    
    str = "N/A"
    
    With Sheets(1).Columns(2)
        Set c = .Cells(1, 1)
        For l = 1 To WorksheetFunction.CountIf(.Cells, str)
            Set c = .Find(what:=str, after:=c)
            Union(c, c.Offset(0, -1)).Copy Sheets(2).Cells(Rows.Count, 1).End(xlUp).Offset(1)
        Next l
    End With
    
    End Sub

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Or using AutoFilter:
    Sub x()
    
    Dim rng As Range
    
    With Sheet1.Range("A1").CurrentRegion
        .AutoFilter field:=2, Criteria1:="n/a"
        .Offset(1, 0).SpecialCells(xlCellTypeVisible).Copy Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1)
    End With
    Sheet1.AutoFilterMode = False
    
    End Sub

  4. #4
    Registered User
    Join Date
    06-11-2006
    Posts
    3

    thanks for replys

    thank you very much for all my freind who reply me
    but please can you explain the code because I`m not professional in excel I`m just simple user
    thanks

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Do you mean explain how to use the code?

    If so, in your workbook, Press Alt & F11 to open the VB editor, Insert > Module and then paste the code into the large white space on the right hand side. I suggest change the name in the top line (currently x) to something meaningful. Then from the worksheet, Tools > Macros > Macros, select the macro and press Run.

    BigBas has provided a formula solution.

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Waffa:

    Although this can be done, there is not a simple formula to do it. That said, I am attaching a sample workbook that does what I believe you want. Sheet1 has entry information. Sheet 2 has the names that are N/A.

    Check the file and let me know if you need any additional assistance.
    Attached Files Attached Files

+ 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