vb-like-operator

wildcard character using like operator vb.net

家住魔仙堡 提交于 2020-01-05 12:33:51
问题 I have a problem using "like" operator. I want to find strings, in a table, like "Address #123" or "Address #56778" or "Address #2b". So, I wrote this in my code: If m_Table.Rows(i).Item("NOTE").ToString Like "*ADDRESS #*" Then But, the code reads the "#" as a wildcard, not a simple character. How can I rewrite my code to make it read the # as a simple character, not a wildcard? 回答1: You can escape the special characters [ ? # * by enclosing them in square brackets [ ] . For more information

Excel VBA: Select Case if ActiveCell like “*string*”

你。 提交于 2019-11-28 09:24:50
I'm working on a macro that takes the current value of the ActiveCell and changes that value based on a select case. However, I am unable to determine if the ActiveCell contains a wild card string. I am not sure if my syntax is correct. How can I get my select case to compare? Select Case ActiveCell.Value Case ActiveCell.Value Like "*string*" ActiveCell.Value = "contains string" End Select It is possible to use wildcards. Keep these two things in mind: First, string comparison expressions evaluate to a Boolean data type (True/False); Second, per the developer reference for the Select...Case

Excel VBA: Select Case if ActiveCell like “*string*”

∥☆過路亽.° 提交于 2019-11-27 02:47:55
问题 I'm working on a macro that takes the current value of the ActiveCell and changes that value based on a select case. However, I am unable to determine if the ActiveCell contains a wild card string. I am not sure if my syntax is correct. How can I get my select case to compare? Select Case ActiveCell.Value Case ActiveCell.Value Like "*string*" ActiveCell.Value = "contains string" End Select 回答1: It is possible to use wildcards. Keep these two things in mind: First, string comparison