Saturday, September 1, 2012

How to extract the Strings which exactly Match with the Desired String in Excel with VBA Macro


VBA Macro To Pull Out Strings Exactly Match with the Desired String in Excel
Sub Serch_Extract()
Dim x As Integer
Dim Y As Integer
Dim Z As Integer
Dim b As Integer
Dim a As String
Dim d As String

b = 1
On Error GoTo Label:
d = InputBox("Enter Your Name: ")
a = InputBox("Hai" & " " & d & " " & "Enter Your Search Sring :")
Y = InputBox("Enter Search Colno :")
Z = InputBox("Enter Search Results Colno :")
Cells(1, Z) = " SEARCH RESULTS"
Cells(1, Z).Font.Bold = True

For x = 1 To 100
If Mid(LCase(Cells(x, Y)), 1, Len(a)) = LCase(a) And Len(LCase(Cells(x, Y))) = Len(a) Then
b = b + 1
Cells(b, Z) = Cells(x, Y)
End If
Next x

Label:
End Sub

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog