Hello all,
Here is my situation, i have code that creates an array based on values from a column. Now in order for the code to work that i'm creating the array for, each entry length in the array must 11. Now I did a code to make this happen in sense but it's not working. It's giving me an error of out of range. Here is the code:
As you can see the Array is simple, the smallest value length that EArr entry is 9. Please let me know what i'm doing wrong. Thank you.
Here is my situation, i have code that creates an array based on values from a column. Now in order for the code to work that i'm creating the array for, each entry length in the array must 11. Now I did a code to make this happen in sense but it's not working. It's giving me an error of out of range. Here is the code:
VBA Code:
Sub ExistArray()
Dim MAINws As Worksheet
Dim lrowMain As Long
Dim Cnt As Long
Set MAINws = ThisWorkbook.Worksheets("Assessments") 'Previous Assessment District Worksheet
lrowMain = MAINws.Cells(Rows.Count, "C").End(xlUp).Row
EArr = MAINws.Range("C2:C" & lrowMain).Value
For Cnt = 1 To UBound(EArr)
Select Case Len(EArr(Cnt, 1))
Case 10
EArr(Cnt) = "0" & CStr(LCase(EArr(Cnt)))
Case 9
EArr(Cnt) = "00" & CStr(LCase(EArr(Cnt)))
End Select
Next Cnt
End Sub
As you can see the Array is simple, the smallest value length that EArr entry is 9. Please let me know what i'm doing wrong. Thank you.