Questions tagged [vb-like-operator]

Use [vb-like-operator] for questions related to the Visual Basic Like operator

18 questions
13
votes
2 answers

Excel VBA: Select Case if ActiveCell like "*string*"

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…
thedeepfield
  • 6,138
  • 25
  • 72
  • 107
3
votes
2 answers

Case (in)sensitive comparison with VB.NET LIKE operator in runtime (without Option Compare)

Is there anyway to use LIKE operator in VB.NET as case sensitive or insensitive during runtime? For example use a flag to do case sensitive or insensitive comparisons. Obviously this can be done by simple converting them into lower case and forcing…
dr. evil
  • 26,944
  • 33
  • 131
  • 201
3
votes
1 answer

wildcard character using like operator vb.net

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…
djobert
  • 55
  • 1
  • 3
  • 7
2
votes
2 answers

VBA like operator in range

I have the following code and I am trying to check the cells in the range for a specific word. The word in this case is Test. It can come up in all sorts of ways, ex: Test program/ Program Test/programTest etc. How do I make the LIKE operator work…
2
votes
4 answers

VBA: How to use like operator to a list of value?

Here's part of my code. Is there any way to make it simple? Thank you. For i = 2 To ws.Range("E1").CurrentRegion.Rows.Count If ws.Cells(i, 4).Value Like ("*SSI*") Then ws.Cells(i, 4).EntireRow.Delete If ws.Cells(i, 4).Value Like ("*Settlement…
883km
  • 27
  • 4
2
votes
1 answer

Is there a javascript equivalent to VB's "LIKE #"?

I need to write a function that can detect whether a string input is a valid format for a date. Allowable formats are: #### (e.g. 2003) ##/#### (e.g. 12/2003) #/#### (e.g. 9/2003) ##/####-##/#### (e.g. 12/2003-04/2005) But I need to prevent invalid…
Urbycoz
  • 7,247
  • 20
  • 70
  • 108
1
vote
1 answer

Like item in VBA?

I was wondering if there is something like a "Like" in VBA for Outlook 2003/2007 just like the LIKE in SQL... For Example you have multiple users in a Network and everyone has another Mailbox name. So i was thinking about something like this: Set…
VanDeath
  • 519
  • 1
  • 7
  • 20
1
vote
2 answers

VBA Excel: Like operator does not working correctly

Why Like function does not work? In this case it returns: "No, it's not" Sub test() If "*ыписка по договору ук-004#1500333*" Like "выписка по договору ук-004#1500333 стд.xlsx" Then MsgBox "Yes, it is!" Else MsgBox "No, it's…
1
vote
1 answer

VBA Excel Not Like String If Statement

I'm trying to write an "If" statement that checks to see if a the Key that corresponds to a Player object in a (Scripting.)Dictionary called Players has a String value that contains the letter "P." I must be missing some VBA syntactical sugar, but…
obizues
  • 1,473
  • 5
  • 16
  • 30
1
vote
1 answer

Go through column and replace if containing these values. If not leave as is

I want to go through column L and replace cells containing these text fields to 0. If not I want to leave as is. The code runs but stops at the first #N/A that it encounters. Sub Drops() Dim i&, z& With Application .ScreenUpdating =…
ichoi
  • 103
  • 7
1
vote
2 answers

Match Complete word in string

I have the below code which populates an offset cell with service should the criteria match. However at this stage, it operates on the basis that should the string appear within a cell, it will apply the value rather than the word being a…
Krishn
  • 813
  • 3
  • 14
  • 28
0
votes
2 answers

VB Script if statement: Sub not defined

I have the code below if (LCase(Config_(C_))) like "show*" Then crt.screen.send Config_(C_) & VBCR crt.screen.WaitForStrings ">", "#" End If but when I run it I get a "Sub not defined on line 36 (which is the "if(LCase(....." line) Config_ is an…
DevilWAH
  • 2,553
  • 13
  • 41
  • 57
0
votes
2 answers

Two strings check true for equal but check false for Like operator

Why doesn't the "Like" statement work? The "=" statement checks as true but the "like" operator checks as false, why? Sub sandbox2() Dim TagForm As String TagForm = "tag(1###)" Debug.Print "Compare: " & Sheets(2).Cells(2, 2).Value & " To:…
XCELLGUY
  • 179
  • 2
  • 12
0
votes
1 answer

How to correctly define a pattern of the Like-Operator (VisualBasic) within "DataColumn.Expression" and the use of lambda?

this is my first question on SO. Please forgive me if I make mistakes in the way I am asking, and please let me no if so. I am currently trying to programmatically sort items from a ComboBox. The data I am filling the CB with are by now processed…
0
votes
1 answer

If else with multiple variables and criteria

I'm pretty new to SQL having a background in excel VBA and I'm trying to translate a large excel vba script in to SQL, which is giving me some trouble, primarily with if else statements. Example table below; Var1____________…
1
2