How to write a specific row value to following cells in column

Hi, I hope someone can help me come up with a solution for this.

Say that I need to extract a value from row A1 in a data table and then write that value to a certain number of rows below the row where I found the original value, in the same column.

Does anyone have a good idea how I might do this?

@Westfield

You mean want to fill empty cell values with above row value in particular column ?

Exactly.

Take the image as an example:
image

I want to take the value ‘Name’ in A1 and write it to cells A2 - A8.

Hi

  1. Use a read cell activity and mention the cell position from where we want to read the cell value and save it in a string variable

  2. Then use a WRITE CELL ACTIVITY to write it back to the cell you want may be within a loop like this

  3. Use a WHILE activity like this
    with a condition

Rowcounter < 9

Where rowcounter is a variable of type int32 with default value as 1 defined in variable panel

  1. Now inside the loop use a write cell activity with the value as string variable obtained from read cell and cell range a

“B”+Rowcounter.ToString

@Westfield

  1. Use Read Range activity to read the data from excel sheet and it will give output as DataTable. Let’s say ‘InputDT’.

  2. And then use For Each row activity and inside that use IF activity and check value is empty or not.

              For Each row in InputDT
                 If String.IsNullOrEmpty(row(0).ToString.Trim)
                 Then
                      row(0) = InputDT.Rows(InputDT.Rows.IndexOf(row)-1)(0)
                  Else
                      Log Message
    
  3. Finally use Write Range activity and pass InputDT to write into Excel file.

Try “Auto fill range” activities :smiley:

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