Excel dynamic search vba code
up vote
0
down vote
favorite
With this VBA macro for Excel I get instant search filter when I type the whole word, but I want it as follows: when I type O for opel, that I get opel already showing.
This is the code:
Sub MG26Nov26
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Ray = Split(TextBox1, "+")
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:=Ray, Operator:=xlFilterValues
End If
End Sub
This is the test file:
https://drive.google.com/open?id=1KDwE2jT_u35wPhd5dR7Xi3X31ddzXDNx
microsoft-excel vba macros
add a comment |
up vote
0
down vote
favorite
With this VBA macro for Excel I get instant search filter when I type the whole word, but I want it as follows: when I type O for opel, that I get opel already showing.
This is the code:
Sub MG26Nov26
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Ray = Split(TextBox1, "+")
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:=Ray, Operator:=xlFilterValues
End If
End Sub
This is the test file:
https://drive.google.com/open?id=1KDwE2jT_u35wPhd5dR7Xi3X31ddzXDNx
microsoft-excel vba macros
Try changing ray toRay = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
With this VBA macro for Excel I get instant search filter when I type the whole word, but I want it as follows: when I type O for opel, that I get opel already showing.
This is the code:
Sub MG26Nov26
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Ray = Split(TextBox1, "+")
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:=Ray, Operator:=xlFilterValues
End If
End Sub
This is the test file:
https://drive.google.com/open?id=1KDwE2jT_u35wPhd5dR7Xi3X31ddzXDNx
microsoft-excel vba macros
With this VBA macro for Excel I get instant search filter when I type the whole word, but I want it as follows: when I type O for opel, that I get opel already showing.
This is the code:
Sub MG26Nov26
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Ray = Split(TextBox1, "+")
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:=Ray, Operator:=xlFilterValues
End If
End Sub
This is the test file:
https://drive.google.com/open?id=1KDwE2jT_u35wPhd5dR7Xi3X31ddzXDNx
microsoft-excel vba macros
microsoft-excel vba macros
edited Nov 27 at 22:30
Worthwelle
2,2593824
2,2593824
asked Nov 27 at 18:18
Louai Al Falahi
32
32
Try changing ray toRay = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07
add a comment |
Try changing ray toRay = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07
Try changing ray to
Ray = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
Try changing ray to
Ray = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
To solve the issue, you can use the below written VBA code.
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Text & "*", Operator:=xlFilterValues
End If
End Sub
N.B. This is the Change I've done in the VBA Code Criteria1:="*" & TextBox1.Text & "*"
in place of the Ray
variable.
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
To solve the issue, you can use the below written VBA code.
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Text & "*", Operator:=xlFilterValues
End If
End Sub
N.B. This is the Change I've done in the VBA Code Criteria1:="*" & TextBox1.Text & "*"
in place of the Ray
variable.
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
add a comment |
up vote
0
down vote
accepted
To solve the issue, you can use the below written VBA code.
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Text & "*", Operator:=xlFilterValues
End If
End Sub
N.B. This is the Change I've done in the VBA Code Criteria1:="*" & TextBox1.Text & "*"
in place of the Ray
variable.
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
To solve the issue, you can use the below written VBA code.
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Text & "*", Operator:=xlFilterValues
End If
End Sub
N.B. This is the Change I've done in the VBA Code Criteria1:="*" & TextBox1.Text & "*"
in place of the Ray
variable.
To solve the issue, you can use the below written VBA code.
Private Sub TextBox1_Change()
Dim Ray As Variant
If Len(TextBox1.Value) = 0 Then
Sheet1.AutoFilterMode = False
Else
If Sheet1.AutoFilterMode = True Then
Sheet1.AutoFilterMode = False
End If
Sheet1.Range("A2:F" & Rows.Count).AutoFilter field:=1, Criteria1:="*" & TextBox1.Text & "*", Operator:=xlFilterValues
End If
End Sub
N.B. This is the Change I've done in the VBA Code Criteria1:="*" & TextBox1.Text & "*"
in place of the Ray
variable.
answered Nov 28 at 7:46
Rajesh S
3,5111422
3,5111422
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
add a comment |
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
Woowww that worked for me.Thank your very much!!
– Louai Al Falahi
Nov 28 at 16:06
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
@LouaiAlFalahi,, glad to help you and happy to learn that my solution worked for you. If you wish accept it as Answer also you can up vote it ☺
– Rajesh S
Nov 29 at 6:55
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1378851%2fexcel-dynamic-search-vba-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try changing ray to
Ray = Split(TextBox1 & "*", "+")
– Christofer Weber
Nov 28 at 0:06
This worked for me too. You have really excel skills! thank you very much
– Louai Al Falahi
Nov 28 at 16:07