Hello forum dwellers,
I have a workbook to produce which has many sheets in it. I have created code to compare the value of the first cell in a specific sheet to a value from a table which I have written to a variable. However, when using the immediate window, I see that pulling the value from the cell adds a space at the beginning. The comparison then evaluates improperly (which I believe is linked to the phantom space).
If x < Cells(1, 1) Then GoTo Line1
If x > Cells(1, 1) Then GoTo Line2
If x = Cells(1, 1) Then GoTo Line3
The value in cell A1 of the active sheet is 1301853. The immediate window shows x = 130303 (correct), but
Cells(1,1) = " 1301853" (quotes not present, but illustrating space). However, the actual cell does not contain that leading space.
When stepping through the macro, the first If statement comes back false, and the second true, even though 130,303 < 1,301,853, and I can only think it is due to the phantom space that the Cells(1,1) call seems to be adding. Help please
.
Bookmarks