I've got a variable that is assigned a value from a spreadsheet cell as follows:
PctTot = spr.Value(1,2)
However, it always returns a value of 1 no matter which spreadsheet cell I direct it to. When I hover over the variable named PctTot in debug mode it shows that the value for PctTot is 1#.
I know I'm directing the variable to get the value from the intended cell because if I replace the line of code above with
spr.Value(1,2) = "Bob"
it writes Bob in the correct cell, however, it's not correctly retrieving a value from that cell when the original line of code is used. What is causing it to return 1# for PctTot no matter what value is in the cell I direct it to?
I figured out that using
PctTot = spr.Cells(1,2).Value
works, whereas the code in the above post didn't.