Wildcard

Faiek

New Member
Joined
May 2, 2011
Messages
48
Hi I have this code for a wildcard search,
Code:
Sub wildcardsearch()

 Dim Found As Boolean
 Dim FoundCell As Range
 Dim FirstAddx As String
 Dim num As String
 Dim SearchCount As Integer
 Dim wks As Worksheet
 Dim search As String
 search = Replace(TextBox1.Text, "*", "")
 
    For Each wks In Worksheets
        Select Case wks.Name
            Case "Cross-ref"  'change/add as desired"
                Set FoundCell = wks.Cells.Find(what:=Me.TextBox1.Value, LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
                If Not FoundCell Is Nothing Then
                   Found = True
                   FirstAddx = FoundCell.Address
                   
                   Do
                     ' wks.Activate
                     'FoundCell.Select
                
                     
                     
                     
                     With Wildcard.Results_wc
                       .AddItem (FoundCell)
                    
                     End With
                     Set FoundCell = wks.Cells.FindNext(After:=FoundCell)
                     If FoundCell Is Nothing Then Exit Do
                     If FoundCell.Address = FirstAddx Then Exit Do
                     Wildcard.Show
                     
                    
                     
                     
                     
                    Loop
                End If
        End Select
    Next wks
    
    If Not Found Then
  MsgBox ("Value Not Found")
    End If
  
End Sub
But It seems not to work, any suggestions?
Also a * Must be entered to run this sub that's why it has
Code:
search = Replace(TextBox1.Text, "*", "")
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Consider using
Code:
search = Replace(TextBox1.Text,Chr(42), "")
instead.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top