Increment Number In For Each Row Activity


Kindly, I need your help, I am reading the data from Excel and save it in the data table (customer site information), to add the site information, I get the customer number and I save it in a variable, then I use for each row activity to add this information on the website. inside this loop, I need to create a site number, by increment one number on the customer number for each site, I need your help at this point.

Example: If the customer number is 100 so the first site number is 101 then for the second site 102 … etc.



  • Index - A zero-based index that specifies what element of the current collection is being iterated, stored in an Int32 variable.

Combining this with e.g. counter Variable like Counter=100 and Counter = index + 1 it is possible to get an auto incremented index

  1. Create a integer variable outside the for each
  2. In the for each row you do:
    2.1 SiteNumber = Cint(row(“customer number”)) + 1

"customer number” is the variable that will be outside the for each?

it is the name of your column in which you will have the number you want to start increment… not sure if it is in the data table… if not then change that to like:
2.1 Use variable in your for each row

2.X varSiteNumber = varSiteNumber + 1 (last thing in for each row)