Chinaunix首页 | 论坛 | 博客
  • 博客访问: 773100
  • 博文数量: 217
  • 博客积分: 2401
  • 博客等级: 大尉
  • 技术积分: 2030
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-16 06:58
个人简介

怎么介绍?

文章分类

全部博文(217)

文章存档

2023年(2)

2022年(3)

2021年(29)

2020年(12)

2019年(5)

2018年(5)

2017年(5)

2016年(3)

2015年(6)

2014年(12)

2013年(16)

2012年(9)

2011年(6)

2010年(15)

2009年(30)

2008年(59)

我的朋友

分类:

2008-11-24 03:35:37

Understanding the Crystal Ball Macro Framework

 

Macro Name

Runs...

Alt

CBBeforeSimulation

Immediately after the Start Simulation command or Single-Step command

CBBeforeTrial

Before random numbers have been placed in assumption cells

CBAfterRecalc

After Excel has recalculated the model but before a trial value has been retrieved from the forecast cells

CBAfterTrial

After the forecast trial values have been retrieved and entered into the forecast charts

CBAfterSimulation

When the simulation is complete or stopped with a Stop command, by single-stepping (after each step), or for any other reason

 
The above are all functions, but we can call procedure inside these functions. For example:
 
 
Macro
Public Sub EmbedSolver()
    Range("C17:G17").Select
    Selection.Copy
    Range("C13:G13").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    SolverOk SetCell:="$B$15", MaxMinVal:=1, ValueOf:=0, ByChange:="$C$9:$G$11", _
        Engine:=2, EngineDesc:="Standard Simplex LP"
    SolverSolve (True)
    Range("B15").Select
End Sub
Function
Public Function CBAfterTrial(aTrial As Long) As Integer
    Call EmbedSolver
End Function
阅读(1153) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~