Cannot be added to double type

I have a double value that I would like to increase using the following snippet:

        Total = CDbl(Total + CDbl(Workbooks(1).Worksheets(1).Cells(1,1).Value))

      

The code continually returns a type mismatch error, even if the cell it points to has a decimal value. What am I doing wrong?

0


a source to share


1 answer


Make sure the cell you are pointing to actually contains a number and not just a textual representation of the number.



To convert a text cell to a number, select the cell and then select Format / Cells from the menu bar, and then on the Number tab, click General.

+2


a source







All Articles