PDA

View Full Version : [SOLVED:] Long length value convert to determine set length



khhoa
10-05-2015, 03:40 PM
Hello,

This is the data I have for example:


The value determine in textbox2 will determine how many counts then new line of the remainder of the value in textbox1


userform1
textbox1.value = 1234567890

textbox2.value = 2

Results:


1.

12



2.
34



3.
56



4.
78



5.
90





Results 2:
textbox1.value = 1234567890

textbox2.value = 5


1.
12345



2.
67890

SamT
10-05-2015, 07:01 PM
Private Sub test()
s = 1
r = 1
For i = 1 To Len(TextBox1) Step CLng(TextBox2)
Cells(r, 1) = Mid(TtextBox1, s, TextBox2)
r = r + 1
s = s + TextBox2
Next
End Sub

khhoa
10-06-2015, 09:25 AM
Thanks SamT it works great!

Currently trying to add an error if it does not divide equally.