+ Reply to Thread
Results 1 to 5 of 5

Macro debugging

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Macro debugging

    Hi, I have the following code which returns a 'Subscript out of range' error when I run it. I have a function with input in cell F2 and output in cell N2. I'd like to take a list of non-null values in column C as inputs and record the corresponding outputs in column D.

    Please Login or Register  to view this content.
    I'm new to VBA - Could someone please tell me what the problem is?
    Many thanks!
    Last edited by VelvetRevolver84; 06-01-2013 at 03:04 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Macro debugging

    I think your sheetname is without a underscore.
    Worksheets("All Data")

    Please Login or Register  to view this content.
    Kind regards, Harry.

  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: Macro debugging

    See http://www.cpearson.com/excel/DebuggingVBA.aspx

    What happens when you step through it?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    05-31-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Macro debugging

    Getting rid of the underscore fixed the error, but I realized that I also need to move the i = i + 1 outside of End If for it to work properly. Step feature was really helpful. Thanks!

  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: Macro debugging

    You're welcome.

    Nothing will improve your code-writing skills like debugging your own code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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