Not seeing integer

M

Martin Wheeler

xl2000
I am trying to introduce a variable into some existing code, below. I am
trying to get the value of F to change depending on the value of A. The
problem is with F, I think. When I simply set FT.value to 25 or 35 it runs
fine.
The code is running but not doing anything.
Any help would be appreciated.
Ta,
Martin

Public Sub FTwentyFive1()
Dim Ce As Range
Dim FT As Range
Dim D As Range
A = Application.WorksheetFunction.CountIf(Range("G8:I12"), "<-.05")
B = Application.WorksheetFunction.CountIf(Range("J8:J10"), "<-.04")
C = Application.WorksheetFunction.CountIf(Range("J11:J12"), "<-.05")
A = A + B + C
If A = 0 Then
F = 35
Else
F = 25
For Each FT In Range("K7:K31")
If FT.Value >= F Then
Set D = FT
With D.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlColorIndexAutomatic
End With
Set Ce = D.Offset(-1, 0)
With Ce.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlColorIndexAutomatic
End With
Exit For
End If
Next
End If
End Sub
 
M

Martin Wheeler

Hi Trevor,
Thanks, you are right.
Ta,
Martin


Trevor Shuttleworth said:
Martin

with a single value of -0.06 in cell G8 your code works for me. I suspect
it's the data, not your code.

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top