Thanks Taylor! I managed to figure out a bit of the code. I shared a more detailed response on what I'm planning to do in a previous thread/response: https://www.energycommunity.org/default.asp?action=9&tid=3372&fid=22
Sub ChangingModelAssumptions()
Set L = CreateObject("LEAP.LEAPApplication")
L.ActiveArea = "Dar es Salaam and Lusaka"
L.ActiveRegion = "Lusaka"
L.ActiveView = "Analysis"
L.ActiveScenario = "Current Accounts"
'Changing electrification rate
'L.Branch("Demand\Urban Households\Electrified Households").Variable("Activity Level").Expression = Sheets("InputDataDar").Range("B20").Value
'Changing travel distance
L.Branch("Key\Average Trip Distance").Variable("Activity Level").Expression = Sheets("InputDataDar").Range("B10").Value
End Sub
My question is: how do I print results from say 1000 simulations to excel, using randomly generated inputs to cell B20 and B10 in my worksheet (I have a list of about 6 variables that I'd like to randomly change)? I would also like to analyze results directly within Crystal Ball - therefore having the LEAP result somehow "captured" by Crystal Ball for the analysis to be conducted. I know Charles Heaps has mentioned previously that this is possible using a few lines of VBA code. Would you be able to share some example code to do this?
Thanks a lot!