Option Explicit
Function losujcałkowitą(a As Integer, b As Integer) As Integer
Randomize
losujcałkowitą = Int((b - a + 1) * Rnd + a)
End Function
Sub generujzakres()
Dim zakres As Range
Set zakres = Range("A1:A20")
Dim komorka
For Each komorka In zakres
komorka.Value = losujcałkowitą(-100, 100)
Next komorka
End Sub
Sub usunujemne()
Dim zakres As Range
Set zakres = Range("A1:A20")
Dim komorka
For Each komorka In zakres
If komorka.Value < 0 Then
komorka.Value = Empty
End If
Next komorka
End Sub
Sub ujemnenaczerwono()
Dim zakres As Range
Set zakres = Range("A1:A20")
Dim komorka
For Each komorka In zakres
komorka.Font.Color = RGB(0, 0, 0)
If komorka.Value < 0 Then
komorka.Font.Color = RGB(255, 0, 0)
End If
Next komorka
End Sub