Solved

How to get Excel "Cell" instruction to work

Posted on 2014-02-27
6
178 Views
Last Modified: 2014-02-27
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.
0
Comment
Question by:Leonard Gojer
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 39893431
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
0
 

Author Comment

by:Leonard Gojer
ID: 39893445
I tried

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

and the Cell in question did not show anything
0
 

Author Comment

by:Leonard Gojer
ID: 39893458
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.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
ID: 39893460
Can you show the code you have that runs your command?

Do you know how to use the debugger and stop on that line to ensure that r1 has the correct value?
0
 

Author Comment

by:Leonard Gojer
ID: 39893467
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.
0
 

Author Closing Comment

by:Leonard Gojer
ID: 39893469
Good job in answering me to the best of your abilities.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now