Import Data Table and header has two lines

I am importing an excel file into a Data Table. The header on one of the columns has two lines of text within one cell. When I import that into the Data Table it bring the header in with the return in the header. Does anyone know how I can use that header in an assign variable when it contains the return???

just rename the column name after read range and remove the line break

YourDataTableVar.Column(IntIndex).ColumnName =
when not working also try vbCr vbCrLf

Feel free to dynamize it and change all cols within a loop

What do I use for IntIndex??? Might be a silly question, sorry.

it is 0 based e.g. for the second column we are using 1

1 Like

Got it. How can I put it into a loop to change all the columns???

for each Activity (not the for each row activity) item in YourDT.Columns | TypeArgument: DataColumn

  • Assign Activity: item.ColumnName = item.ColumnName.Replace(vbLf,"")
1 Like

@ppr you are the best!!! Thank you very much!

If I have information in a data column, say 5570, and I need that information to be 8 digits with leading zeros, 00005570, is there any easy way to do that?


1 Like

And if I was doing it the opposite way…00005570 to 5570, is there a command to do that?

give a try at

What if I only wanted to limit it to 6 digits from the right? So 005570

now its better that you open a new topic as we prefer to scope 1Topic = 1 case.
Just describe all variations which are to adress there

1 Like

Ok. Thank you.

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