tourless
Board Regular
- Joined
- Feb 8, 2007
- Messages
- 144
- Office Version
- 365
- Platform
- Windows
Hi Folks,
I know this has been asked a thousand times and I'm trying to implement some of the solutions I've found but I just can't seem to get this to work. I have values in column I that four decimal places deep and I simply want to remove the last two characters. The problem I'm noticing is some of the values only contain two digits even though the cells are formatted to four decimal places. So a value of 56.34 is formatted as 56.3400. Other cells have actual values that are three of four decimal places deep, such as a value of 5.7324 is formatted as 5.7324, and a value of 4.242 is formatted as 4.2420. So I guess I need to evaluate each cell in my range and add a few if's to account for the variations? This is what I'm working with.
I know this has been asked a thousand times and I'm trying to implement some of the solutions I've found but I just can't seem to get this to work. I have values in column I that four decimal places deep and I simply want to remove the last two characters. The problem I'm noticing is some of the values only contain two digits even though the cells are formatted to four decimal places. So a value of 56.34 is formatted as 56.3400. Other cells have actual values that are three of four decimal places deep, such as a value of 5.7324 is formatted as 5.7324, and a value of 4.242 is formatted as 4.2420. So I guess I need to evaluate each cell in my range and add a few if's to account for the variations? This is what I'm working with.
VBA Code:
For i = 2 To LastRow
.Cells(i, "I") = Left(.Cells(i, "I").Value, Len(.Cells(i, "I").Value) - 2)
Next i