View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim F Jim F is offline
external usenet poster
 
Posts: 26
Default quick code question

Ok the function "Fix" returns the "Integer" portion of the value (leaves off
the decimal). If you are looking to see if the active cell is a decimal then
you could simply change it to:

If ActiveCell.Value < Fix(ActiveCell.Value)


"Celt" wrote:


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"???


--
Celt
------------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...o&userid=19413
View this thread: http://www.excelforum.com/showthread...hreadid=520343