Link to home
Start Free TrialLog in
Avatar of Leonard Gojer
Leonard GojerFlag for United States of America

asked on

How to get Excel "Cell" instruction to work

I'm trying to write an Excel VBA program that will use a worksheet to debug the steps of the code so that I can see where I am programming it incorrectly. I want to use the Cell instruction to display intermediate values of the code, but it doesn't do anything and actually causes the compiler/interpreter to stop and malfunction.

Please tell me how to invoke this instruction correctly.
Avatar of rspahitz
rspahitz
Flag of United States of America image

The Cells object is really a collection of all cells on the worksheet.  To use it for an individual cell, specify the row and column to get back a cell object, which you can then investigate.

ActiveSheet.Cells(1,1).value = 123
Avatar of Leonard Gojer

ASKER

I tried

ActiveSheet.Cells(20 + count, 1).value = r1 ' r1 = 0.70345   count = 0

and the Cell in question did not show anything
I believe that you are telling me the truth, but I also believe that there is something else wrong with my spreadsheet that is causing this bug. That's what I don't like about VBA, it doesn't handle bugs like C# does.
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I even tried changing r1 to "123" and it did not work, because of other lines of code in the program that are causing the bug.

I don't want to take too much of your time, because I hired a programmer to help me with this.

Thank you for answering my question.
Good job in answering me to the best of your abilities.