Are the only possible cell values single decimal place numbers as shown in your two examples? If not, what should happen with values like 0.123 or 12.3456?Hi, i would like to create a vba code so that to turn decimals into integer number for col. "K" and "N".
e.g.: 0.5 convert as 5.0
0.2 convert as 2.0
Hi Rick, I am sorry that i done a fault. In these columns (K and N) the most cells numbers are with single decimal but there is also an integer too, like 1.0 (format). Regarding your above examples the numbers should convert as follow:
0.123 should be 1.2
12.3456 should be 12.3
Many thanks for your support
Okay, that makes more sense although I think you have a mistake on the first one as you did not round it like you did the other examples... I'll assume it should have been rounded up. Here is a macro that should do what you are indicating you want...I am a little bit confused now and so i write all the circumstances.
0.0025 should be 0.2
0.0456 should be 4.6
0.1864 should be 18.6
2.4568 should be 245.7
[table="width: 500"]
[tr]
[td]Sub MultiplyAllValuesInColumnsKandNby100()
Dim Col As Variant
For Each Col In Array("K", "N")
With Range(Cells(1, Col), Cells(Rows.Count, Col).End(xlUp))
.Value = Evaluate(Replace("IF(ISNUMBER(@),ROUND(100*@,1),IF(@="""","""",@))", "@", .Address))
End With
Next
End Sub[/td]
[/tr]
[/table]