Friday, August 31, 2012

How to Extract All Search Item Records from One Sheet to Another Sheet in Excel with VBA

VBA Macro to Pull Out All Search Item Records From One Sheet to Another Sheet
Sub Search_Extract()
Dim x As Integer
Dim Y As Integer
Dim Z As Integer
Dim A As Integer
Dim c As String
A = 1
c = InputBox(" Enter Search String ")
Sheets.ADD.Name = c

For Z = 1 To 26
For x = 1 To 100

If InStr(LCase(Sheets("AAA").Cells(x, Z)), LCase(c)) Then
A = A + 1

For Y = 1 To 26
Sheets(c).Cells(A, Y) = Sheets("AAA").Cells(x, Y)
Sheets(c).Cells(1, Y) = Sheets("AAA").Cells(1, Y)
Next Y

End If
Next x
Next Z
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.