Number of rows in a dynamic Grid Layout

Hi

In a dynamic grid layout which has options for addtion and deletion of a row, help me to find the position of the last row since a counter values gets jumbled after addition and detetion of rows.