C
Celt
I am playing around with some code I was given in a previous post,
learning what each peice does. I am trying to tweak it a little to
meet my needs. I have a quick question. Here is the code I am working
with.....
Sub MacroYellow()
Dim i As Long
Dim j As Long
Dim Lrow As Long
Dim Lcol As Long
Range("A1").Select
Selection.SpecialCells(xlCellTypeLastCell).Select
Lrow = ActiveCell.Row
Lcol = ActiveCell.Column
For i = 6 To Lrow
For j = 4 To Lcol
Application.Goto Cells(i, j)
If ActiveCell.Value = Fix(ActiveCell.Value) Then
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual,
_
Formula1:="=MOD(ActiveCell.Value,1)=0"
Selection.FormatConditions(1).Interior.ColorIndex = 6
End If
Next j
Next i
Range("A1").Select
End Sub
Basicallly, this macro is searching columns of data starting at cell
D6. the columns contain numbers. I want the macro to check if the
number contains a decimal and if so, change the conditional formatting
so that the cell turns yellow (I am using conditional formatting so
that once the decimal is removed the cell will go back to normal). I
think the above will work once I change this line (if I am wrong please
tell me!!!!)...
If ActiveCell.Value = Fix(ActiveCell.Value) Then
How do I say "not equal"???
learning what each peice does. I am trying to tweak it a little to
meet my needs. I have a quick question. Here is the code I am working
with.....
Sub MacroYellow()
Dim i As Long
Dim j As Long
Dim Lrow As Long
Dim Lcol As Long
Range("A1").Select
Selection.SpecialCells(xlCellTypeLastCell).Select
Lrow = ActiveCell.Row
Lcol = ActiveCell.Column
For i = 6 To Lrow
For j = 4 To Lcol
Application.Goto Cells(i, j)
If ActiveCell.Value = Fix(ActiveCell.Value) Then
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual,
_
Formula1:="=MOD(ActiveCell.Value,1)=0"
Selection.FormatConditions(1).Interior.ColorIndex = 6
End If
Next j
Next i
Range("A1").Select
End Sub
Basicallly, this macro is searching columns of data starting at cell
D6. the columns contain numbers. I want the macro to check if the
number contains a decimal and if so, change the conditional formatting
so that the cell turns yellow (I am using conditional formatting so
that once the decimal is removed the cell will go back to normal). I
think the above will work once I change this line (if I am wrong please
tell me!!!!)...
If ActiveCell.Value = Fix(ActiveCell.Value) Then
How do I say "not equal"???