Dynamic Index for Data Tables

Hi. I’m trying to Set Range Color in Excel using an If statement to provide conditions. I want the Set Range Color to cover the entire scope of the Sheet and color which ever conditions apply. How do I make my selector dynamic? I have set a variable(RangeIndex) for my for each row output. That is the one pictured. Please let me know How I could do this… Yes, there are headers in the datatable.

Thank you!!

Hi @alvini,
RangeIndex will alway return the number of rows so having for example 25 rows in you case it will grab only latest row: “A25:G25”.
You could just make int variable which will work as a counter starting from number 1 (because 0 index is for headers) and at the end of each loop just increase it by 1 for next run?

Thank you I was able to do “A”+(RangeIndex+2).ToString+":G"+(RangeIndex+2).ToString
as headers are located in index 1 of the excel file. So actual data started from index 2 :slight_smile:

1 Like