Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check if a String is inside an Array
You can use the worksheet function Index:
Option Explicit Sub testme() Dim res As Variant Dim MyArray As Variant MyArray = Array("Test", "This") res = Application.Match("this", MyArray, 0) If IsError(res) Then MsgBox "Not in there" Else MsgBox "It's there and at position: " & res End If End Sub Luis Carrion wrote: Hi, If I were to check if a variable: A="Test" is inside a list of possible strings,Iīll do this: Dim A as string Dim B as variant Dim MyArray As variant MyArray=Array("Test", "This") For Each B in MyArray If A=B then Msgbox "Itīs inside the group Next A Is it possible to test this in other way; something like this If A is in/like MyArray then....... ---without looping inside the array Thanks. LC -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check for NON-presence of a string in another string | Excel Worksheet Functions | |||
Searching for a string of text inside a column | Excel Worksheet Functions | |||
Table Lookup formula where 2 known values are inside array | New Users to Excel | |||
how can I check for cell focus inside a spreadsheet ? | Excel Worksheet Functions | |||
Need macro to insert text string while inside cell (formula) | Excel Discussion (Misc queries) |