+ Reply to Thread
Results 1 to 3 of 3

Wildcard search, copy and paste in excel 2010

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2013
    Location
    Singapore, Singapore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Wildcard search, copy and paste in excel 2010

    i am add in a wildcard search in my programming, so far, i am able to search only a single column and i'm able to copy that searched row and paste it in my desired form, what's needed to add into my codes to make a wild card search?


    Sub macrotest()
    Dim strSearch
    
     
    strSearch = Application.InputBox("Please enter the search string")
    x = 2
    
    Do While Cells(x, 1) <> ""
    
    
     
    If Cells(x, 2) = strSearch Then
    
    Worksheets("Sheet1").Rows(x).Copy
    
    Worksheets("Sheet2").Activate
    
    erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    
    ActiveSheet.Paste Destination:=Worksheets("Sheet2").Rows(erow)
    End If
    
    Worksheets("Sheet1").Activate
    
    x = x + 1
     
    Loop
    End Sub
    Last edited by IcedMilkTea; 10-22-2013 at 02:41 AM.

  2. #2
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Wildcard search, copy and paste in excel 2010

    for a wildcard search you can use Like instead of =, and place the wildcard on either side of your search term. In your case, replace this:
    If Cells(x, 2) = strSearch Then
    with this:
    If Cells(x, 2) Like "*" & strSearch & "*" Then

  3. #3
    Registered User
    Join Date
    10-22-2013
    Location
    Singapore, Singapore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Wildcard search, copy and paste in excel 2010

    Thanks, it worked!

+ 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. Copy and paste problems - excel 2010 :(((
    By grphillips in forum Excel General
    Replies: 14
    Last Post: 04-04-2013, 01:59 PM
  2. [SOLVED] Excel 2010 - Copy and Paste as Hyperlink
    By rangiesrule in forum Excel General
    Replies: 3
    Last Post: 11-02-2012, 01:14 AM
  3. Excel 2010 copy and paste problem
    By skyline-mis in forum Excel General
    Replies: 0
    Last Post: 09-19-2012, 01:29 PM
  4. Copy and paste issue in Excel 2010
    By massoudrm in forum Excel General
    Replies: 0
    Last Post: 09-01-2012, 11:34 AM
  5. Excel 2010 copy paste malfunction
    By ek2009 in forum Excel General
    Replies: 2
    Last Post: 04-15-2012, 06:41 PM

Tags for this Thread

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