Hello friends oftomorrow.
I have a problem with a simple excel spread sheet containg numbers that needsorting when they meet a criterias.
as you can see below I have this set of numbers and my question can anyone helpme write a program on VBA excel 2010
that will highlight any number that is over 50 when you get a row of 0's and ifany row has a 1 then leave any number over 50 blank(no highlight). example forthe two top rows they are both all zero's and in this instant, 96 will behighlighted (back ground) red (96>50).
the third row has a 1 even though the rest are zero's.
Below is two different code I have so far (VBA code) but it is not doing what Iwant, it just hight light any number over 50.
if you can
I have been at it for over a week and althougth this might be an hours job tosome, it is hard being a beginer.
0 0 0 0 12 39 24 96 0 0 0 0 65 87 44 87 1 0 0 0 41 45 65 35 1 1 1 0 25 42 65 63 0 0 0 1 74 99 41 35 1 0 1 0 36 12 47 14 1 1 0 0 21 35 95 18 0 0 0 0 54 69 32 74 1 0 0 0 98 43 65 96 1 0 0 0 31 31 14 35 0 0 0 0 25 52 25 62 0 1 1 0 41 54 14 68 1 0 0 0 23 45 47 18 0 1 1 0 47 21 26 49 0 0 0 0 12 74 35 42 0 1 1 1 36 69 50 15 0 0 0 0 14 25 48 27 0 0 0 0 78 97 78 28 1 0 1 1 25 29 24 75 0 1 1 1 41 73 56 15 0 0 0 0 65 11 41 72 0 0 0 0 44 9 39 81
Private Sub CommandButton21_Click()
Dim a, counterAs Integer
Dim cell As Range
For a = 1 To 22
If Cells(a,1).Value = 0 Then
For Each cell In Range("E1:H22")
If cell.Value > 50 Then
cell.Interior.ColorIndex = 3
Else
cell.Interior.ColorIndex = 0
End If
Next
counter = counter + 1
Cells(a, 1).Interior.ColorIndex = 3
Else
Cells(a, 1).Interior.ColorIndex = 0
End If
Next a
End Sub
'
'
'
'
'
'
'
Private SubCommandButton21_Click()
Dim cell, hellAs Range
'Dim i, j, count, counter As Integer
For Each cell In Range("E1:H22")
For Each hell In Range("A122")
If hell.Value = 0 Then
If cell.Value > 45 Then
cell.Interior.ColorIndex = 4
Else
cell.Interior.ColorIndex = 0
End If
hell.Interior.ColorIndex = 3
Else
hell.Interior.ColorIndex = 0
End If
Next
Next
End Sub