+ Reply to Thread
Results 1 to 9 of 9

No Error in Code but thee is no code execution

  1. #1
    Registered User
    Join Date
    07-13-2016
    Location
    CT
    MS-Off Ver
    2010
    Posts
    7

    No Error in Code but thee is no code execution

    I am pretty new to VBA but I really don't know why this code isn't working.

    I have a column that is always updated with new dates beginning with a new month and year which is then being provided a numeric value in another column on that same row.

    For example, for analysis of numbers for June-2016, June will be the first month in the column and be assigned 1. Then for the proceeding 12 months they are incremented by 1 and anything blank or after these 12 months is equal to x. (Feb-2016 = 2, Mar-2016 =3, Apr-2016 = 4....June-2017 =12). And as I mentioned for the next month of July-2016 this will now be assigned a 1 in another column and pattern continues. Will this require a number of different for loops within and if statement?

    The code is running with no errors but I don't see any execution of the code. Not sure if I have the if, for and case organized incorrectly?
    Any help with this and if possible in making the code more efficient would be greatly appreciated.

    Thanks

    Please Login or Register  to view this content.
    Last edited by barillas1089; 07-14-2016 at 06:05 PM. Reason: Forum Rules

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: No Error in Code but thee is no code execution

    What is this supposed to be checking?
    Please Login or Register  to view this content.
    As far as I can see VBA will see July as an undeclared, empty variable, so July - 2016 will return -2016.

    Are you actually trying to check for a date?
    If posting code please use code tags, see here.

  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: No Error in Code but thee is no code execution

    Welcome to the board.

    Please take a few minutes to read the forum rules, and then edit your post to remove the picture and post the code in CODE tags.

    Then you can tell us what's in the cells you think your testing but aren't, and what you're trying to do.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    07-13-2016
    Location
    CT
    MS-Off Ver
    2010
    Posts
    7

    Re: No Error in Code but thee is no code execution

    It is referencing to a cell that changes for the current month (July-2016) since the beginning month in the column changes. Even x is a string it will return that? And for this portion I am just trying to check against July-2016 since the cell updates itself throughout the workbook when changed in the input worksheets.

    For the other parts of the code that you see something similar it should be date. Not sure how to tell VBA to look for a date?

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: No Error in Code but thee is no code execution

    What do you actually have in Sheets("Portfolio Matrix").Cells(1, 16).Value?

    Note, this should be within the loop.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-13-2016
    Location
    CT
    MS-Off Ver
    2010
    Posts
    7

    Re: No Error in Code but thee is no code execution

    L has a text formula that is translating a date from another column into MMM-YY format. Thought this would make it easier than dealing with a date format of DD-MM-YY.

    D has the numbers and the one variable (1-12 and x) that I am trying to input into the column and match with column L.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: No Error in Code but thee is no code execution

    I don't see where D is being used in the code or where result or LT come from.

  8. #8
    Registered User
    Join Date
    07-13-2016
    Location
    CT
    MS-Off Ver
    2010
    Posts
    7

    Re: No Error in Code but thee is no code execution

    D is referring to the column of cells that I want to fill with the assigned numbers. It should be used for "=result" as "D=result" but forgot I wrote out a variable for those cells in that column.

    Was not sure how to write a code for the column referred to in D I want everything after the 12 months have been given 1-12 to be equal to LT (which I referred to as x in my first comment). Sorry for the confusion.

  9. #9
    Registered User
    Join Date
    07-13-2016
    Location
    CT
    MS-Off Ver
    2010
    Posts
    7

    Re: No Error in Code but thee is no code execution

    Was able to find the problem, Norie was right, VBA was reading JUly-2016 a different way.

+ 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. Help with Reslving a VBA Code Execution Error
    By yegor2000 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-29-2014, 12:39 AM
  2. [SOLVED] VBA Code Error Upon Execution
    By MacroMan87 in forum PowerPoint Programing
    Replies: 4
    Last Post: 09-21-2013, 01:28 AM
  3. Code execution has been interrupted error on my macro file
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2012, 03:14 AM
  4. Automation Error At Odd Spot in Code Execution
    By Jenn68 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-02-2012, 11:50 AM
  5. Code execution has been interrupted error
    By vpnvipin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-05-2012, 04:35 AM
  6. Error: Code Execution Has Been Interrupted
    By Xrull in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2010, 07:32 AM
  7. error: Code Execution has been interrupted
    By Joshua Fredrickson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2005, 11:50 AM

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