• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Problem: With Excel macro

Malpatti

New Member
VBA program has been running for five years and suddenly the macro “EXECUTE” button is non-operative. Entering the VBA developer and using “run” the program appears to run perfectly. I have verified that macros are enabled in the File/Options/Trust Center and restarted Excel, repaired Excel, and tried Excel 2007 and Excel 2013 all with no help. I have four versions of the program and they all have the same problem. I have tried running them on another computer.
 
Last edited by a moderator:
Welcome to the forum, you say you have done much to tace the problem but have you checked that the Execute button is still linked to the code?
 
Welcome to the forum, you say you have done much to tace the problem but have you checked that the Execute button is still linked to the code?
I do not know how to do that. I am not the original VBA programmer.
I can go to the code for that page in the VBA developer, place the cursor in front of the first line, which reads "Private Sub cmdExecute_Click()" and then hit "run" and it executes just fine.
 
Select the shape by right click, from the drop list select "Assign Macro" from the popup select the macro and click "OK"
 
Select the shape by right click, from the drop list select "Assign Macro" from the popup select the macro and click "OK"
Thank you, however, the "assign macro" is dimmed and not available. So something is turning off that ability as well.
 
This I have not seen before!

Can you make a new shape, do the above and then see if the option is still greyed out?


.
 
I mean the "
Tip:
  • Use
    Code:
     &
    tags to embed your VBA Macros
  • Upload a Sample File to get a quicker response
    "

  • is what I do not understand
 
Create a shape on your spread sheet then do as #4
I can create the shape, but it stays in the condition of being ready to be moved/positioned. It is not finished. When I put the cursor on it (either button) it shows the frame for being re-located. All I can do is move it.
 
save a copy of YOUR file with a different name then strip most but not all the data from the copy and upload so we can have a look.
 
I suggest you contact the author, you have a lot of data and a very large amount of code running on all work sheets, when you select the button top right on the ContVar sheet the VBA is run, you can see this by the extreme bottom left of the work sheet, I have run code on other sheets and it runs and populates the work sheet as it should.
But the code takes a long time to run because of the tasks it is doing. And this may be the reason you think it is not working!!
To tackle such a work book without knowing the workings will end up in tears.

Talk to the author by email.



.
 
Pleased it is sorted, may explain why it ran on my machine.

I would still contact the author, with this work book it would be wise to make friends, I think you will need his help in the future.
 
If you like to solve problems I have had several people work on this for two years. It is the same program.

This program is for investment strategy research using asset class momentum. I used it to develop the investment strategy that I follow and offer to others. It has about 30 years of monthly back data on 51 asset classes and it has a control variable sheet that allowed me to explore a number of strategy alternatives. I started it in 2005/6 and I add to the data base each month. I post monthly on a free web site (www.copstrat.com) [Now closed], along with the investment strategy documentation. The essence of the strategy, which has now been verified by a great many academic researchers, is that high profit performance in a give asset is likely to repeat the next month, ie, performance has momentum.


After the description of the program that follows I will point out the option that fails.

When you open the program please select sheet “FullCase2.” This is the latest run after having been updated with the data from January. Look at line #69 (“H=1”). This is the performance result for basic strategy case for this run. As you can the strategy does very well returning 21.19% average over 20 years and 18.45% last year. This case invests in the top three performing assets (out of 51) each month. It is also shown on Chart 3. In chart 3 the “compare case” is the same except that the six top assets were invested in. Both sheets show the S&P500 (SPDR) in comparison.


Sheet “FullCase1” shows by color coding which assets were invested in. On FullCase1, yellow indicates a high level of momentum measurement which would lead one to invest in that class the next month. Green indicates that the investment was made and the performance sustained. Orange indicates that the investment was made and the performance did not hold up. Note, however, that in many cases where the performance did not remain in the top 3 it was still fairly good which is also verified by the returns accumulated on the next page.

The ContVar sheet allows one to select how many funds were held at a given time (The red number by TN). The more classes you invest in the lower the volatility and the smoother the performance, however, the total return goes down as well. Give it a ride by changing TN and hitting Execute.


The sheet AC (second page) is intended to allow one to exclude some asset classes in a test case. To illustrate the problem with this option, you can look at FullCase1 and see that the program did not invest in certain classes at all in a given year or two, say 2010 and 2011. By placing a 0 next to these classed in AC and running a repeat case you would not expect the results in those years to change. Indeed, all the way through FullCase1 the program seems to execute perfectly. FullCase1 is missing the excluded classes and all of the same classes are selected as in the prior case. So the performance calculations should be the same for those years, but, they are not. In fact the performance is clearly way off.


I can pinpoint the problem more closely for you (It seems like a relatively simple indexing logic problem.) The VBA routines for FullCase are where the returns are calculated. Those routines scan through FullCase1 color codes for each month and calculate the return for the classes that were invested in. That is the sum up the returns of the asset classes that have a green or orange color. For those classes the program goes to RM1 to get the individual monthly returns. If all classes are selected (have a “1”) in Sheet AC then the returns are calculated correctly. I believe that you could have 0s at the beginning and at the end of the list as well and it would work. It only does not work if the 0s are mixed in the columns with the 1s. That seems like a simple indexing problem doesn’t it? I am afraid that I am too simple to solve the problem.


I very sincerely hope that you can find the time to help me with this problem.


Mal Williams
 
Back
Top