I was wondering if someone could assist me with debugging the following module, I believe my only issue lies in the last (if) statement in order for cells to be filled in with a color. The general module creates a cell range of randomized numbers that should be filled in with the colour red if an input of a certain value is entered in the input box. Thanks!
Option Explicit
Sub test()
Dim i As Integer
Dim j As Integer
Dim user As Integer
Dim cell As Range
Dim random_number As Integer
Dim itm As Integer
For Each cell In Range("A1:J10")
random_number = Int(100 * Rnd) + 1
cell.Value = random_number
Next
Dim mycount As Integer
Dim myarray(1 To 10, 1 To 10)
For i = 1 To 10
For j = 1 To 10
myarray(i, j) = Cells(i, j).Value
Next
Next
user = CInt(InputBox("enter a number betweeen 1 and 100"))
If user < 1 Or user > 100 Then
msgbox ("Error, wrong value entered")
Exit Sub
End If
For i = 1 To 10
For j = 1 To 10
If myarray(i, j) > user Then
Range(Cells(i, j)).Interior.Color = RGB(255, 0, 0)
itm = itm + 1
End If
Next
Next
msgbox itm
End Sub