Solved

How to get Excel "Cell" instruction to work

Posted on 2014-02-27
6
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maxBlock challenge 30 146
pre4 challenge 19 111
count11 challenge 6 85
Excel file not created as expected 7 94
This article will show, step by step, how to integrate R code into a R Sweave document
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

730 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