Select dynamic Range in Copy Paste Range

Hello :slight_smile: ,

I am using a Copy Paste Range in my project and i am facing two problems to define my range.
1st Problem :
I want to copy the whole row and paste it in another position, but the last column of this row is dynamic it changes from a file to anothern in another hand i have a variable that counts my colums columnX=strData.Columns.Count. I think it would be more clear in the picture below

2nd Problem :
I want to copy the hole range starting from Column B and a dynamic Row rowX=strData.Rows.IndexOf(row) and paste it starting from A7 as shown in the picture below.

Thank you in advance for your help :slight_smile:

1st Problem: The SourceRange would be: β€œB” + rowX.tostring + β€œ:” + ColumnName + rowX.tostring.

To get the ColumnName variable, you can use a loop as described here to convert the columnX variable you’re using to the Excel Column letters needed:

Convert a Column Number to Excel Header

Regrettably, I am out of time today, but will attempt to provide a solution to the second problem if I am able.

I hope this is helpful!