John, thanks again.
I write down all suggested code snippets and take it apart using VBE help files.
Now, you misunderstood me a little. I have two sheets, the "main" sheet does not matter to me, it could be empty or full of stuff. On the "Shading" sheet, on the other hand, I have numbers 1:25...
Thanks, Skip.
I thought the problem was ActiveCell, that is, when I am in "main" sheet, active cell is in that sheet rather than in "Shading", and that was the cause of the problem.
Sergo
Thanks, John, but the question is not so much whether VBA is required, but rather why the code does not work in this particular case. I am trying to understand how VBA functions.
Sergo
Hello,
THough I have been registered here for a year, I've never really used VBA, until 2 days ago. Decided to learn a little.
background and question:
I have an open workbook with 2 worksheets: "Shading" and "main". I want to shade every second row in Shading as long as there are values in the...
John, thanks! Now I understand!
Zack, not non-contiguous, no. I ment the following:
the way the function is written now, for it to return the correct value (that is - expected value, not -1), I have to input FIRST vector of values and THEN vector of probabilities. So it is, so to speak...
Hi, Zack
This is a basic Expected Value calculation function. I call it from an Excel spreadsheet writing =ExpVal(A1:A5; B1:B5), for example. So there are 2 arrays of numerical data in that same spreadsheet - a vector of probabilities in B1:B5, (probabilities sum to 1), and a vector of values...
Hello, guys
This is my first post.
Moreover, I am novice at VBA.
I got a couple of questions. I have this code for expected value calculation:
[COLOR=blue]
Function ExpVal(vvec, pvec)
' returns expected value for 2 arrays
If Application.Sum(pvec) <> 1 Or _
Application.Count(vvec) <>...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.