Not seeing integer
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:I1 2"), "<-.05") B = Application.WorksheetFunction.CountIf(Range("J8:J1 0"), "<-.04") C = Application.WorksheetFunction.CountIf(Range("J11:J 12"), "<-.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 |
Not seeing integer
Hi Trevor,
Thanks, you are right. Ta, Martin "Trevor Shuttleworth" wrote in message ... 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 "Martin Wheeler" wrote in message ... 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:I1 2"), "<-.05") B = Application.WorksheetFunction.CountIf(Range("J8:J1 0"), "<-.04") C = Application.WorksheetFunction.CountIf(Range("J11:J 12"), "<-.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 |
All times are GMT +1. The time now is 08:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com