Results 1 to 7 of 7

Looping though multiple strings

Threaded View

  1. #1
    Registered User
    Join Date
    12-28-2006
    Posts
    97

    Looping though multiple strings

    Is there a way to loop though a string and pull out each letter and assign it to its own variable that can be recaled using Letter1 letter2 ect?

    Sub IndivLetter()
    
    Dim num As Integer
    Dim strArray() As String
    Dim strText As String
    Dim lLoop As Long, lCount As Long
    Dim Letter(1 To 20)  As Variant
    
    
    
    'pull out each letter and assign numeric value
    strText = "Thisisareallylongstringtestwithnospaces"
        lCount = Len(strText)
        ReDim strArray(lCount - 1)
    
            For lLoop = 0 To lCount - 1
                y = lLoop
                strArray(lLoop) = Mid(strText, lLoop + 1, 1)
                Letter & lLoop  = strArray(lLoop)
                
            Next lLoop
    
         MsgBox Letter1
         MsgBox Letter4
    
    End Sub

    I have gotten this to work with a message box but I want to have each letter be assigned as it's own varible or string.
    For Counter = 1 To Len(part3)
    
    Letter & Counter = Mid(part3, Counter, 1)
        'do something to each character in string
        'here we'll msgbox each character
        MsgBox Mid(part3, Counter, 1)
    Next
    Last edited by insanity66; 05-27-2010 at 10:56 AM.

Thread Information

Users Browsing this Thread

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

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