hello
sir
getting error when run the loop and going to last value of row count
please help

and i can not use the 2nd loop in the place of cells(?????) number how can i use this

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

What I have tried:***

Dim aa As Integer
       For Z1 = 0 To DataGridView1.RowCount

           If Me.DataGridView1.Rows(Z1).Cells(2).Value = True Then
               aa = 1
           Else
               aa = 0
           End If
           Me.DataGridView1.Rows(Z1).Cells(7).Value = aa
           If Me.DataGridView1.Rows(Z1).Cells(3).Value = True Then
               aa = aa & 1
           Else
               aa = aa & 0
           End If
           Me.DataGridView1.Rows(Z1).Cells(7).Value = aa
           If Me.DataGridView1.Rows(Z1).Cells(4).Value = True Then
               aa = aa & 1
           Else
               aa = aa & 0
           End If
           Me.DataGridView1.Rows(Z1).Cells(7).Value = aa
           If Me.DataGridView1.Rows(Z1).Cells(5).Value = True Then
               aa = aa & 1
           Else
               aa = aa & 0
           End If
           Me.DataGridView1.Rows(Z1).Cells(7).Value = aa
           If Me.DataGridView1.Rows(Z1).Cells(6).Value = True Then
               aa = aa & 1
           Else
               aa = aa & 0
           End If
           Me.DataGridView1.Rows(Z1).Cells(7).Value = aa
       Next

Try

For Z1 = 0 To DataGridView1.RowCount - 1

If you have 5 rows, for example, the indices are 0, 1, 2, 3, 4

commented: thanks sir +2
commented: "Hey that's my luggage combination" - Programmer President Skroob. +15