Private Sub countmines(ByVal row As Integer, col As Integer) rl = row - 1 rh = row + 1 cl = col - 1 ch = col + 1 If rl < 0 Then rl = 0 If rh = 10 Then rh = 9 If cl < 0 Then cl = 0 If ch = 10 Then ch = 9 For i = rl To rh For j = cl To ch If nums(i, j) = True Then mcount = mcount + 1 Call expand(i, j) End If Next j Next i squares((row) * 10 + col).Visible = False lsquares((row) * 10 + col).Caption = mcount End Sub Private Sub expand(ByVal row As Integer, col As Integer) rl = row - 1 rh = row + 1 cl = col - 1 ch = col + 1 If rl < 0 Then rl = 0 If rh = 10 Then rh = 9 If cl < 0 Then cl = 0 If ch = 10 Then ch = 9 For i = rl To rh For j = cl To ch If nums(i, j) = True Then mcount = mcount + 1 Else Call countmines(i, j) End If Next j Next i squares((row) * 10 + col).Visible = False lsquares((row) * 10 + col).Caption = mcount End Sub