Sub test()
Set WBS = ThisWorkbook.Worksheets("Лист1")
Let i = 2
Let j = 2
'197 197 197
Do While WBS.Cells(1, j).Value <> ""
Do While WBS.Cells(i, 1).Value <> ""
If WBS.Cells(i, j).Interior.Color <> RGB(197, 197, 197) Then 'или if WBS.Cells(i, j).Interior.Pattern = xlNone then |(197,197,197) - серый цвет
WBS.Cells(i, j).Value = Int(Rnd(1) * 100) 'числа от 1 до 100
End If
i = i + 1
Loop
i = 2
j = j + 1
Loop
End Sub