Hi all, I am new to this forum so let me go ahead and apologize if I have titled this thread wrong or if I need to be more descriptive. Please just say so and I will do my best to adhere to the way yall do things around here! no problem!

I am working on a encrypt/decrypt program as I am trying to teach myself VBA. Earlier I created a few programs to calculate income tax on a principal, and then I created a program that counts a number of integers that occur in a string.. however neither of those did I have to use arrays. So I am looking for some guidance.

What I am trying to do is take a 4 digit number and encrypt it by replacing each digit with the sum of it plus a number (i.e. 7) modulus 10. Then I am going to try to further encrypt it one more step to where I will swap the digits around (i.e. swap the 1st and 3rd, and the 2nd and 4th).

I have looked around online and in a text I bought and I am pretty sure I have to store the 4 values as arrays and put it within a loop for extracting the values using something along the lines of the MID function? Whatever that is, I wasn't able to really understand what it does.

Anyway, this is kind of what I have... its obviously not correct though as it is not running. I am hoping someone could just guide me as to what I need to adjust. Sorry if my coding is redundant... I am a noob and trying my best through what I find online.

Private Sub CommandButton1_Click()
Dim encrypt(3) As Integer

    encrypt(0) = Mid(TextBox1, 1, 1)
    encrypt(1) = Mid(TextBox1, 2, 1)
    encrypt(2) = Mid(TextBox1, 3, 1)
    encrypt(3) = Mid(TextBox1, 4, 1)
    
    For encrypt = 0 To 3
    Arr(LoopVar) = (Arr(LoopVar) + 7) Mod 10
    Next
    
    
    'Arr(0) = Arr(0) + 7
    'Arr(1) = Arr(1) + 7
    'Arr(2) = Arr(2) + 7
    'Arr(3) = Arr(3) + 7
    
    
    
    TextBox2.value = Arr(2) & Arr(3) & Arr(0) & Arr(1)

End Sub