![]() |
Help with Code
I have the following code to Id duplicates in column "I" based on user input
as to the value they are looking for, such as 125 or 125.00. This and any whole number work fine. However, when it is not a whole number such as 9.58 conditional formatting rounds it to ten. What do I do to stop rounding and use the actual value? Dim nval As Long With Worksheets("tcf") nval = Application.InputBox("Enter Duplicate #", Type:=1) End With Columns("I:I").Select Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:=nval Selection.FormatConditions(1).Interior.ColorIndex = 3 As always, your help is appreciated. Ronbo |
Help with Code
hi
what is causing the rounding off is your declaration. dim nval as long a long is a whole number as is an integer. you need to use a declaration that takes decimals. dim nval as single (or double) in vb help look up data types. regards FSt1 "Ronbo" wrote: I have the following code to Id duplicates in column "I" based on user input as to the value they are looking for, such as 125 or 125.00. This and any whole number work fine. However, when it is not a whole number such as 9.58 conditional formatting rounds it to ten. What do I do to stop rounding and use the actual value? Dim nval As Long With Worksheets("tcf") nval = Application.InputBox("Enter Duplicate #", Type:=1) End With Columns("I:I").Select Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:=nval Selection.FormatConditions(1).Interior.ColorIndex = 3 As always, your help is appreciated. Ronbo |
All times are GMT +1. The time now is 11:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com