Copy row to same datatable

Dt_Input =
class, div, name
1st row- FirstYear,B,Bob
2nd row- , ,John
3rd row-, , Jan

Could you please suggest how to copy 1st row in to 2nd and 3rd(only class and div)
total number of row are not fixed in above eg I took 3 names it may be 12/20 also
If there is 20 names in Name column we need to copy 1st row class div to entire 20 names

Expected o/p

Class,div,name
FirstYear,B,Bob
FirstYear,B,jhon
First Year,B,jan

#question #help

1 Like

@Tate_S you could do this by using drag option in excel itself.I do not see any benefit from automating this scenario.It is simple excel process

@Tate_S

If data is in Excel…Then use Fill Range

If data is in Datatable then use the below in Assign

dt_Input.Columns("class").Expression = "'" + dt.Rows(0)("class").ToString + "'"

Repeat same for Div column as well

You can use column Name or Index(I used index in screenshot and name in the give formula above)

image

cheers

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