0
For g = 1 To 10
For f = 1 To 10
Cells(f, g) = Int(100 * Rnd())
k = Cells(f, g)
If Int(k / 2) - k / 2 = 0 Then
pares = pares + 1
Else
Impares = Impares + 1
End If
If k = 0 Then Zeros = Zeros + 1
If k > 10 Then MaioresQuedez = MaioresQuedez + 1
Cells(12, 2) = pares & " números Pares"
Cells(14, 2) = Impares & " números Ímpares"
Cells(16, 2) = Zeros & " números Zero"
Cells(18, 2) = MaioresQuedez & " números maiores do que 10"
Next f
Next g
Isn’t it better to read each cell, see if it has value, and compare the value with what you need? For odd numbers, just see if the rest of the division by 2 is 1. I’m putting the logic to see if it helps you, since I don’t know Vb.
– Rodrigo Tognin
I’ve tried but I can’t.
– luana
It was not clear to me the use of the variable W. So I made the example only for the variable K. If it is W or both, just adapt the code. Luana, edit your question not to use photos or "Printscreen" in the case of codes, you can do the same for results. So: in the header of the question text, there are the brackets "{ }", use to "paste" or enter the code you made. There is the icon to insert "images". You can "copy" the area of the worksheet you want to show and "paste" in this area. You can also edit the "Printscreen" screen in Word with "Format" and "Cut" and paste in this area.
– Leo