grohm
08-04-2008, 09:21 AM
HI all
basically, i want to check automatically if a value is bigger than another value and in case it is, mark it with a color.
now i want the whole thing only to take place within a certain area of rows. lets say i want to compare X1 to W1 and X2 to W2 etc and stop on X12 to W12. in case any of the values in the X column are bigger than the compared value in W. i want it to mark that on with a color.
here is what i came up with but somehow it just doesnt work and gives me 1004....
Sub Button1_Click()
Dim afv As Integer
Dim ev As Integer
afv = InputBox("Bitte Anfangs Value eingeben (Row Nr.)")
ev = InputBox("Bitte Endvalue eingeben (Row Nr.)")
For x = afv To ev
If ActiveSheet.Cells(x, afv).Value > ActiveSheet.Cells(w, afv).Value Then
ActiveSheet.Cells(x, afv).Interior.ColorIndex = 4
End If
Next x
End Sub
many thx for all of your help
basically, i want to check automatically if a value is bigger than another value and in case it is, mark it with a color.
now i want the whole thing only to take place within a certain area of rows. lets say i want to compare X1 to W1 and X2 to W2 etc and stop on X12 to W12. in case any of the values in the X column are bigger than the compared value in W. i want it to mark that on with a color.
here is what i came up with but somehow it just doesnt work and gives me 1004....
Sub Button1_Click()
Dim afv As Integer
Dim ev As Integer
afv = InputBox("Bitte Anfangs Value eingeben (Row Nr.)")
ev = InputBox("Bitte Endvalue eingeben (Row Nr.)")
For x = afv To ev
If ActiveSheet.Cells(x, afv).Value > ActiveSheet.Cells(w, afv).Value Then
ActiveSheet.Cells(x, afv).Interior.ColorIndex = 4
End If
Next x
End Sub
many thx for all of your help