I tried to round down my value following: How to round to 2 decimal places in VBA?
I send Outlook email, where the costs rounded to two decimal phases in Excel are changed to being rounded down to three decimal places in the Outlook HTML body.
I did something like this:
Dim bs as Worksheet
Dim Cost As Single
Dim linecount2 As Long
Set bs = Sheets("BoM")
linecount2 = 2
Cost = Format(bs.Range("E80")(linecount2, 2), "0.00")
I get:
Type mismatch
I tried another solution:
Cost = Format(bs.Cells(linecount2, 2), "0.00")
Cost = Round(bs.Cells(linecount2, 5), 80) ' because my cell is E80
Cost = WorkshhetFunction.Round(bs.Cells(linecount2, 5), 80) ' because my cell is E80
Here the debugger points to the last line, saying
variable is not defined
The previous example was based on cell B2. My situation refers to cell E80.
How do I round this number to two decimal places?