Select Items with certain text and sort VBA and Excel
Find items with certain text and put them in another list.
Sort the new list. Use the instr function and the sort function in VBA
code
Sub sortwithtext()
‘
‘
Dim x As Integer
Dim textstring As String
Dim erow As Long
‘sortwithtext Macro
‘go through each record in a
‘display the list sorted in b
x = 1
erow = 0
Do While Sheet3.Cells(x, 1) not equal to””
If InStr((Sheet3.Cells(x, 1)), “XYZ”)(is greater than) 0 Then
textstring = Sheet3.Cells(x, 1)
erow = erow + 1
‘if it has xyz then bring it column b
Sheet3.Cells(erow, 2) = textstring
End If
x = x + 1
Loop
‘sort the numbers after xyz
Range(“B1:B” & erow).Sort key1:=Range(“B1:B” & erow), order1:=xlAscending, Header:=xlNo
End Sub
For more help visit my website or email me at easyexcelanswers@gmail.com.
Contact me regarding customizing this template for your needs.
Excel one-on-one on-line training available. Email me to arrange.
I am able to provide online help on your computer at a reasonable rate.
Check out my next one-hour Excel Webinar
I use a Blue condensor Microphone to record my videos, here is the link
Check out Crowdcast for creating your webinars
If you need to buy Office 2019 follow
I use Tube Buddy to help promote my videos
Check them out
Follow me on Facebook
Follow me on twitter
easyexcelanswers
IG @barbhendersonconsulting
You can help and generate a translation to you own language
*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.
ww
Watch more new videos about Excel Office | Synthesized by Mindovermetal English
Mam , can we use vba code in shared file one drive