Looking string inside cell Text (VB)What is the difference between String and string in C#?How do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?Case insensitive 'Contains(string)'How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?Does Python have a string 'contains' substring method?How do I convert a String to an int in Java?Why is char[] preferred over String for passwords?
Confusion about off peak timings of London trains
Random Unitary Matrices
Arriving at the same result with the opposite hypotheses
Why is one of Madera Municipal's runways labelled with only "R" on both sides?
Passing multiple files through stdin (over ssh)
PhD - Well known professor or well known school?
How is water heavier than petrol, even though its molecular weight is less than petrol?
Why would future John risk sending back a T-800 to save his younger self?
What's up with this leaf?
What's the name of this light airplane?
What should the arbiter and what should have I done in this case?
What risks are there when you clear your cookies instead of logging off?
Was the output of the C64 SID chip 8 bit sound?
Payment instructions allegedly from HomeAway look fishy to me
Winning Strategy for the Magician and his Apprentice
Do any instruments not produce overtones?
Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?
Smooth switching between 12 V batteries, with a toggle switch
Is an early checkout possible at a hotel before its reception opens?
What does the term "railed" mean in signal processing?
Why was the Sega Genesis marketed as a 16-bit console?
Is using haveibeenpwned to validate password strength rational?
When conversion from Integer to Single may lose precision
Implement Homestuck's Catenative Doomsday Dice Cascader
Looking string inside cell Text (VB)
What is the difference between String and string in C#?How do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?Case insensitive 'Contains(string)'How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?Does Python have a string 'contains' substring method?How do I convert a String to an int in Java?Why is char[] preferred over String for passwords?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm looping row inside sheet and I want to find string inside some text:
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
lrk = wsK.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lr --looping list
look_name = UCase(ws.Range("E" & i).Value)
For j = 2 To lrk --loop patern value
look_text = UCase(wsK.Range("A" & j).Value)
If look_name Like "*look_text*" Then --if found
ws.Range("AB" & i) = wsK.Range("B" & j).Value --to do
Exit For
End If
Next j
Next i
I think something wrong I did with "*look_text*"
If look_name = "New city"
and look_text = "city"
, it's not going into IF.
excel vba string
add a comment |
I'm looping row inside sheet and I want to find string inside some text:
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
lrk = wsK.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lr --looping list
look_name = UCase(ws.Range("E" & i).Value)
For j = 2 To lrk --loop patern value
look_text = UCase(wsK.Range("A" & j).Value)
If look_name Like "*look_text*" Then --if found
ws.Range("AB" & i) = wsK.Range("B" & j).Value --to do
Exit For
End If
Next j
Next i
I think something wrong I did with "*look_text*"
If look_name = "New city"
and look_text = "city"
, it's not going into IF.
excel vba string
1
Why do you think you did something wrong with"*look_text*"
?
– Ron Rosenfeld
Mar 24 at 16:31
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37
add a comment |
I'm looping row inside sheet and I want to find string inside some text:
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
lrk = wsK.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lr --looping list
look_name = UCase(ws.Range("E" & i).Value)
For j = 2 To lrk --loop patern value
look_text = UCase(wsK.Range("A" & j).Value)
If look_name Like "*look_text*" Then --if found
ws.Range("AB" & i) = wsK.Range("B" & j).Value --to do
Exit For
End If
Next j
Next i
I think something wrong I did with "*look_text*"
If look_name = "New city"
and look_text = "city"
, it's not going into IF.
excel vba string
I'm looping row inside sheet and I want to find string inside some text:
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
lrk = wsK.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lr --looping list
look_name = UCase(ws.Range("E" & i).Value)
For j = 2 To lrk --loop patern value
look_text = UCase(wsK.Range("A" & j).Value)
If look_name Like "*look_text*" Then --if found
ws.Range("AB" & i) = wsK.Range("B" & j).Value --to do
Exit For
End If
Next j
Next i
I think something wrong I did with "*look_text*"
If look_name = "New city"
and look_text = "city"
, it's not going into IF.
excel vba string
excel vba string
edited Mar 25 at 7:13
Pᴇʜ
27.3k63052
27.3k63052
asked Mar 24 at 16:26
4est4est
1,06341533
1,06341533
1
Why do you think you did something wrong with"*look_text*"
?
– Ron Rosenfeld
Mar 24 at 16:31
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37
add a comment |
1
Why do you think you did something wrong with"*look_text*"
?
– Ron Rosenfeld
Mar 24 at 16:31
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37
1
1
Why do you think you did something wrong with
"*look_text*"
?– Ron Rosenfeld
Mar 24 at 16:31
Why do you think you did something wrong with
"*look_text*"
?– Ron Rosenfeld
Mar 24 at 16:31
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37
add a comment |
2 Answers
2
active
oldest
votes
Another option, since you are adding wild-card *
in the beginning and the end of your String
, is to use Instr
Function.
If Instr(look_name, look_text) > 0 Then
Edit 1: with text provided from PO
If InStr("abcabc testa abcbc", "test") > 0 Then
MsgBox "Instr Works"
End If
I have tested your code and it's not working, when I change it toIf InStr(look_name, look_text) > 0
then is working correctly
– 4est
Mar 25 at 8:16
@4est it's"look_text"
, you need to add the"
– Shai Rado
Mar 25 at 12:09
no, I need to use&
to connect parameter, without this is not working
– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. TheInstr
will give you the same result as usingLike "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
|
show 4 more comments
I managed to solve the issue by changing
If look_name Like "*look_text*" Then
to
If look_name Like "*" & look_text & "*" Then
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2fstackoverflow.com%2fquestions%2f55325948%2flooking-string-inside-cell-text-vb%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Another option, since you are adding wild-card *
in the beginning and the end of your String
, is to use Instr
Function.
If Instr(look_name, look_text) > 0 Then
Edit 1: with text provided from PO
If InStr("abcabc testa abcbc", "test") > 0 Then
MsgBox "Instr Works"
End If
I have tested your code and it's not working, when I change it toIf InStr(look_name, look_text) > 0
then is working correctly
– 4est
Mar 25 at 8:16
@4est it's"look_text"
, you need to add the"
– Shai Rado
Mar 25 at 12:09
no, I need to use&
to connect parameter, without this is not working
– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. TheInstr
will give you the same result as usingLike "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
|
show 4 more comments
Another option, since you are adding wild-card *
in the beginning and the end of your String
, is to use Instr
Function.
If Instr(look_name, look_text) > 0 Then
Edit 1: with text provided from PO
If InStr("abcabc testa abcbc", "test") > 0 Then
MsgBox "Instr Works"
End If
I have tested your code and it's not working, when I change it toIf InStr(look_name, look_text) > 0
then is working correctly
– 4est
Mar 25 at 8:16
@4est it's"look_text"
, you need to add the"
– Shai Rado
Mar 25 at 12:09
no, I need to use&
to connect parameter, without this is not working
– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. TheInstr
will give you the same result as usingLike "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
|
show 4 more comments
Another option, since you are adding wild-card *
in the beginning and the end of your String
, is to use Instr
Function.
If Instr(look_name, look_text) > 0 Then
Edit 1: with text provided from PO
If InStr("abcabc testa abcbc", "test") > 0 Then
MsgBox "Instr Works"
End If
Another option, since you are adding wild-card *
in the beginning and the end of your String
, is to use Instr
Function.
If Instr(look_name, look_text) > 0 Then
Edit 1: with text provided from PO
If InStr("abcabc testa abcbc", "test") > 0 Then
MsgBox "Instr Works"
End If
edited Mar 26 at 12:19
answered Mar 24 at 17:42
Shai RadoShai Rado
29.8k71633
29.8k71633
I have tested your code and it's not working, when I change it toIf InStr(look_name, look_text) > 0
then is working correctly
– 4est
Mar 25 at 8:16
@4est it's"look_text"
, you need to add the"
– Shai Rado
Mar 25 at 12:09
no, I need to use&
to connect parameter, without this is not working
– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. TheInstr
will give you the same result as usingLike "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
|
show 4 more comments
I have tested your code and it's not working, when I change it toIf InStr(look_name, look_text) > 0
then is working correctly
– 4est
Mar 25 at 8:16
@4est it's"look_text"
, you need to add the"
– Shai Rado
Mar 25 at 12:09
no, I need to use&
to connect parameter, without this is not working
– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. TheInstr
will give you the same result as usingLike "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
I have tested your code and it's not working, when I change it to
If InStr(look_name, look_text) > 0
then is working correctly– 4est
Mar 25 at 8:16
I have tested your code and it's not working, when I change it to
If InStr(look_name, look_text) > 0
then is working correctly– 4est
Mar 25 at 8:16
@4est it's
"look_text"
, you need to add the "
– Shai Rado
Mar 25 at 12:09
@4est it's
"look_text"
, you need to add the "
– Shai Rado
Mar 25 at 12:09
no, I need to use
&
to connect parameter, without this is not working– 4est
Mar 25 at 13:13
no, I need to use
&
to connect parameter, without this is not working– 4est
Mar 25 at 13:13
@4est if you can give me the string you need to check trust me it will work. The
Instr
will give you the same result as using Like "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
@4est if you can give me the string you need to check trust me it will work. The
Instr
will give you the same result as using Like "*" & look_text & "*"
– Shai Rado
Mar 25 at 13:17
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
I have checked all possibility with string (at beginning, in the middle, at end) and it's not working, sorry
– 4est
Mar 25 at 18:18
|
show 4 more comments
I managed to solve the issue by changing
If look_name Like "*look_text*" Then
to
If look_name Like "*" & look_text & "*" Then
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
add a comment |
I managed to solve the issue by changing
If look_name Like "*look_text*" Then
to
If look_name Like "*" & look_text & "*" Then
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
add a comment |
I managed to solve the issue by changing
If look_name Like "*look_text*" Then
to
If look_name Like "*" & look_text & "*" Then
I managed to solve the issue by changing
If look_name Like "*look_text*" Then
to
If look_name Like "*" & look_text & "*" Then
edited Mar 24 at 17:25
Vadim
7,99243645
7,99243645
answered Mar 24 at 16:54
4est4est
1,06341533
1,06341533
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
add a comment |
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
Thank you @Vadim for adjust answer
– 4est
Mar 24 at 20:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f55325948%2flooking-string-inside-cell-text-vb%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
1
Why do you think you did something wrong with
"*look_text*"
?– Ron Rosenfeld
Mar 24 at 16:31
On my test data it's not working, maybe somewhere else is mostake....
– 4est
Mar 24 at 16:33
What, exactly, do you mean by not working?
– Ron Rosenfeld
Mar 24 at 16:34
You should probably read the HELP topics for How do I Ask a Good Question, and also How to create a Minimal, Complete, and Verifiable example. Then edit your post to provide information that will enable the group to help you.
– Ron Rosenfeld
Mar 24 at 16:35
It's not going inside if , when the string is inside my text
– 4est
Mar 24 at 16:37