How to get the first 50 characters in a row from excel to do data entry

The purpose is to read each row from excel to do data entry. The original code is: Row(1).ToString

How to get the first 50 characters to do data entry for the first field and the remaining for second field?

Thanks in advance.

1 Like


Try this:

String.Substring(startIndex, length)




Hi buddy @junnieset

  1. For first field with 50 characters
    First_set_50 = row(1).ToString.Substring(0,50)

Second_set_50 = row(1).Tostring(50, row(1). Tostring.Length)

Where first number is the starting index from where to start and second is the number of characters to be taken…


1 Like

Thanks! So the second field will be row(1).tostring.substring(51,*)?

It would be like this buddy
row(1).Tostring(50, row(1). Tostring.Length)

Weird. I don’t know where I go wrong for the second set. I got this error saying “too many arguments to ‘Public ReadOnly Default Property Chars(index As Integer) As Char’. What is wrong?


There are two ways we can use Substring function

String.SubString(startIndex as Integer, Length as Integer)

String.SubString(startIndex as Integer)

If further you don’t want to divide it then you can use this: Row(1).Tostring.SubString(51)


Thanks! This format works for me. I used row(1).tostring.substring(50) instead as I ended up missing 1 letter when I use 51. Thank you very much for the enlightenment! :wink:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.