DIM MYSTRING As String, MYARRAY() As String
...
MYSTRING = "1-NORD-OVEST|2-NORD-EST|4-SUD|3-CENTRO|5-ISOLE"
MYARRAY = Split(MYSTRING, "|")
...
Ho to check if
VALORE="3-CENTRO"
if VALORE exists in array or in MYSTRING?
SEARCH IN ARRAY
-
- PlatinumLounger
- Posts: 4497
- Joined: 26 Apr 2010, 17:36
SEARCH IN ARRAY
Last edited by HansV on 06 Oct 2023, 12:07, edited 1 time in total.
Reason: SERCAH --> SEARCH
Reason: SERCAH --> SEARCH
-
- Administrator
- Posts: 79444
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SEARCH IN ARRAY
Code: Select all
If Instr("|" & MYSTRING & "|", "|"&VALORE & "|") Then
' Found
Else
' Not found
End If
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 166
- Joined: 11 Jun 2012, 20:37
Re: SEARCH IN ARRAY
in array:
Code: Select all
If IsError(Application.Match(VALORE, MYARRAY, 0)) Then
'not found
Else
'found
End If
-
- Administrator
- Posts: 79444
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 5StarLounger
- Posts: 614
- Joined: 14 Nov 2012, 16:06
Re: SEARCH IN ARRAY
Code: Select all
msgbox ubound(filter(myarray,"3-CENTRO"))>-1