Closed Thread
Results 1 to 4 of 4

Multiple items Search, select, copy and past in new sheet!

  1. #1
    Registered User
    Join Date
    07-15-2015
    Location
    Dordrecht, Holland
    MS-Off Ver
    2013
    Posts
    8

    Multiple items Search, select, copy and past in new sheet!

    Hi there, I'm new here and would appreciate if you could give me some help.
    I have a workbook with lots of text in it and i want to Search Multiple items, select, copy and paste them in a new sheet. The items are IO Inputs and Outputs from a PLC (AA:0.I.Data.0, AB:0.I.Data.0...)

    I found this VBA code on the forum, but is not really what i need. I don't need a input box and all items i need are in column B.


    Public Sub FindText()
    'Run from standard module, like: Module1.
    'Find all data on all sheets!
    'Do not search the sheet the found data is copied to!
    'List a message box with all the found data addresses, as well!
    Dim ws As Worksheet, Found As Range
    Dim myText As String, FirstAddress As String
    Dim AddressStr As String, foundNum As Integer

    myText = InputBox("Enter text to find")

    If myText = "" Then Exit Sub

    Sheets("Search").Select
    Range("A2:L625748").Select
    Selection.ClearContents
    Range("A1").Select

    For Each ws In ThisWorkbook.Worksheets
    With ws
    'Do not search Search sheet
    If ws.Name = "Search" Then GoTo myNext

    Set Found = .UsedRange.Find(what:=myText, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)

    If Not Found Is Nothing Then
    FirstAddress = Found.Address

    Do
    foundNum = foundNum + 1
    AddressStr = AddressStr & .Name & " " & Found.Address & vbCrLf

    Set Found = .UsedRange.FindNext(Found)

    'Copy found data row to sheet4 Option!
    Found.EntireRow.Copy _
    Destination:=Worksheets("Search").Range("A65536").End(xlUp).Offset(1, 0)
    Loop While Not Found Is Nothing And Found.Address <> FirstAddress
    End If

    myNext:
    End With

    Next ws

    If Len(AddressStr) Then
    MsgBox "Found: """ & myText & """ " & foundNum & " times." & vbCr & _
    AddressStr, vbOKOnly, myText & " found in these cells"
    Else:

    MsgBox "Unable to find " & myText & " in this workbook.", vbExclamation
    End If
    End Sub
    Last edited by nitozinho; 12-16-2015 at 04:50 PM.

  2. #2
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Help with Multiple Search items, select, copy and past in new sheet!

    Dear nitozinho!

    The formulation of the problem is not the most expedient manner. Please study the Forum Rules.
    Anyone who wants to help will not browse a code that is not only real answer something like that.
    Attach a file excel.xlsx. Give an example of how inputs should produce what outputs. Append all the explanations, if you think it necessary.
    If i have the time and urge, I will be glad to help. Probably others will also help you.

    regads Pan314

  3. #3
    Registered User
    Join Date
    07-15-2015
    Location
    Dordrecht, Holland
    MS-Off Ver
    2013
    Posts
    8

    Re: Help with Multiple Search items, select, copy and past in new sheet!

    Thank you for you fast reaction Pan314, i will study the Forum Rules. Probably i formulated my question in a wrong way, but i am checking log files from PLC's and i have to get all in an outputs from these files.
    The in and outputs are not important, what i need is a code that searches for multiple items if it finds the items copy them and paste in a new sheet.
    I don't have a Excel.xlsx file, sorry.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Multiple items Search, select, copy and past in new sheet!

    ALSO

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. copy and past rows on multiple sheets into master sheet
    By asqw in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-13-2014, 06:59 AM
  2. copy and past cell from multiple sheets into master sheet
    By asqw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2014, 07:10 AM
  3. copy and past cell on multiple sheets into master sheet
    By asqw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2014, 07:09 AM
  4. Code to search for items, copy to different sheet and delete them
    By pemb3545 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-30-2014, 10:45 AM
  5. [SOLVED] How do I copy and past selected rows to a new sheet when multiple conditions are met?
    By Terri H in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2013, 09:36 AM
  6. Pop Up to select the range and past to another sheet.
    By himanshug in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2012, 03:10 AM
  7. [SOLVED] select & copy some range and past it to another sheet with sum
    By pedjvak in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-01-2012, 12:24 AM

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