+ Reply to Thread
Results 1 to 5 of 5

check the value of a variable in code

  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    check the value of a variable in code

    Hello. How do I check the value of a variable in my code. Can I use the immediate window? Code below. I just want to see the value of firstrow. I guess it's sort of easy to just step through. But what if the code is much larger? Can I use the immediate code to sort of create different scenarios?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,880

    Re: check the value of a variable in code

    How do I check the value of a variable in my code. Can I use the immediate window?
    yes, you can use the immediate window, though I think it is easier to use the locals window, where all active variables and their current values are displayed, or the watch window. This page describes how to use all three windows to examine the current values of variables: http://www.cpearson.com/excel/DebuggingVBA.aspx

    Can I use the immediate code to sort of create different scenarios?
    Yes, you can. I personally do not use this strategy, so I cannot comment on its utility, but, it is certainly possible to change variables within the immediate window to test scenarios. How useful this is will probably depend more on your skill as a programmer in using the feature.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: check the value of a variable in code

    Or you can just hover the cursor over the variable.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: check the value of a variable in code

    Thank you my people.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: check the value of a variable in code

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error in a Code. Object variable or With block variable not set????
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-03-2014, 12:20 PM
  2. [SOLVED] Excel VBA error code 91: Object variable or with block variable not set
    By wilnexpc in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-24-2013, 11:46 AM
  3. [SOLVED] Vba code to fill check in & check out counts
    By ashfaquebwd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2013, 09:02 AM
  4. [SOLVED] vba code to be correct and check ,vba code to brig data for the same refreince
    By funtastic in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-25-2012, 02:29 PM
  5. [SOLVED] Store variable in worksheet and use that variable in VBA code
    By ExcelGal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2012, 08:20 AM
  6. How do I check if a variable is 1 or 2 or 3 or 4?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 05:04 PM
  7. Error Code 91 Object Variable or With Block variable Not Set
    By florencia in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2008, 04:46 AM
  8. vbOK and check for variable
    By Matt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2005, 01:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1