Excel search and save problem
Closed
Sharon
-
8 Feb 2012 à 06:19
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 14 Feb 2012 à 10:38
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 14 Feb 2012 à 10:38
Related:
- Excel search and save problem
- Save as pdf office 2007 - Download - Other
- Spybot search and destroy - Download - Antivirus
- Excel mod apk for pc - Download - Spreadsheets
- Yahoo search history - Guide
- Google search from usa - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
14 Feb 2012 à 10:38
14 Feb 2012 à 10:38
Hi Sharon,
Start by giving column A, the column with 400,000 - 600,000 program names, a header. Now select cell A1 and apply autofilter.
Now run the code below.
Excel will ask you to input a search value.
Type in *.exe for example and hit OK.
Excel will put the search value in B1 and the result below that.
Excel will now ask if there are more extentions to look for.
I hope you like the code:
Bestr egards,
Trowa
Start by giving column A, the column with 400,000 - 600,000 program names, a header. Now select cell A1 and apply autofilter.
Now run the code below.
Excel will ask you to input a search value.
Type in *.exe for example and hit OK.
Excel will put the search value in B1 and the result below that.
Excel will now ask if there are more extentions to look for.
I hope you like the code:
Sub Test()
Dim x, y
Dim nCol, lRow, z As Integer
Start1:
x = InputBox("What is the extention? (example: *.exe)", "Copy data to next column")
z = 0
Do
z = z + 1
If Cells(1, z).Value = "" Then nCol = z
Loop Until Cells(1, z).Value = ""
Selection.AutoFilter Field:=1, Criteria1:=x
Cells(1, nCol).Value = x
lRow = Range("A" & Rows.Count).End(xlUp).Row
If lRow <> 1 Then Range("A2:A" & lRow).Copy Destination:=Cells(2, nCol)
y = MsgBox("Are there more extentions to look for?", vbYesNo)
If y = vbYes Then GoTo Start1
Selection.AutoFilter Field:=1
End Sub
Bestr egards,
Trowa