Results 1 to 4 of 4

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

Threaded View

  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.

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