I am converting values from SAE to Metric and wish to retain the decimal places of the SAE value before converting. My code below converts nicely but doesnt maintain decimal places.
Any hints, tips and or examples are appreciated.![]()
Option Explicit Dim Sh1Range 'Sh1Range Dim Sh1LastRow 'Sht1LastRow Dim Sh1Cell 'Sh1Cell Dim X Dim iTimeStart As Double, iTimeEnd As Double, Y As Double Sub Metric() With Sheets("Sheet1") 'Loop thru Column E Sh1LastRow = .Cells(Rows.Count, "E").End(xlUp).Row Set Sh1Range = .Range("E1:J" & Sh1LastRow) End With For Each Sh1Cell In Sh1Range Sh1Cell.Activate If IsNumeric(Sh1Cell.Value) Then 'get decimal place of cell value and set for converted value X = 25.4 * Sh1Cell.Value Sh1Cell.Value = X End If Next Sh1Cell Columns("E:J").Select Selection.Columns.AutoFit Range("E1").Select End Sub
Bookmarks