Results 1 to 3 of 3

VBA Check of string exists in an Array

Threaded View

mchilapur VBA Check of string exists in... 07-04-2016, 09:57 AM
StephenR Re: VBA Check of string... 07-04-2016, 10:22 AM
mchilapur Re: VBA Check of string... 07-04-2016, 10:30 AM
  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Question VBA Check of string exists in an Array

    Dear all,
    I am trying to develop the macro to get Output as mentioned in a attachment
    I am done upto code as below but i want only unique values(first 3 letters of each cell) to be added in "sloop" variable.
    can anyone please help me to correct the below code..?

    The problem is in line code : ElseIf InStr(1, sloop, xSub) = 1

    Just in order to get best possible solution, this querry is cross posted @
    http://www.ozgrid.com/forum/showthread.php?t=200350


    Sub test()
    Dim xSub As String
        Dim sloop As Variant
         
         
        For Each cell In ActiveSheet.Range("A2", ActiveSheet.Cells(Rows.Count, "A").End(xlUp))
            If cell.Value <> "" Then
                xSub = Left(cell.Value, 3)
                If sloop = Empty Then
                    sloop = xSub
                     'ElseIf InStr(aa, dd) Then
                ElseIf InStr(1, sloop, xSub) = 1 Then
    GoTo iteration:
                Else: sloop = sloop & "," & xSub
     
                End If
            End If
    
    iteration:
        Next cell
    End Sub
    Attached Files Attached Files
    Last edited by mchilapur; 07-04-2016 at 10:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Check if string ends with one of the strings from an array
    By alienss in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-15-2013, 02:58 PM
  2. [SOLVED] Range to array, then check to see if the array contains a string
    By yeahyeahyeah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2012, 12:17 PM
  3. Replies: 7
    Last Post: 08-10-2012, 09:43 AM
  4. Check If Value Exists In Array Help
    By mccrimmon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2011, 12:00 PM
  5. How to check the value of the first letter of a string using the vba array
    By sharrukin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2011, 04:01 PM
  6. Select case to check string array
    By Deamo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2010, 01:27 AM
  7. How to check whether a value exists in a multidimensional array variable?
    By stevenf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-30-2009, 01:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1