views:

63

answers:

1

I have a double value I would like to increment, using the following snippet:

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

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

+2  A: 

Make sure that the cell you are pointing to actually contains a number, and not merely the number's text representation.

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.

Robert Harvey
The cell is formatted as "Number," but for some reason was stored as a text field. I fixed it manually.
A. Scagnelli