根据表格更新折线图(Update line graph based on table)
每张线图都有一张Max Min表。 我想构建一个宏,它将更新每个线图(总共40个)。 请指教。
这是我到目前为止所拥有的。 当我开始学习如何编写VBA时,我确信它编写得很糟糕。
Sub Update_Slope() With Chart(2).Axes(xlValue, xlPrimary) .MaximumScale = ActiveSheet.Range("F58").Value ' Constant value .MinimumScale = ActiveSheet.Range("F68").Value ' Constant Value With Chart(4).Axes(xlValue, xlPrimary) .MaximumScale = ActiveSheet.Range("F59").Value ' Constant value .MinimumScale = ActiveSheet.Range("F69").Value ' Constant Value End With End Sub
I have a table with Max Min for each line graph. I want to build a macro that will update each line graph (40 in total) off of a table. Please Advise.
Here is what I have so far. I'm sure its poorly written as I'm starting to learn how to write VBA.
Sub Update_Slope() With Chart(2).Axes(xlValue, xlPrimary) .MaximumScale = ActiveSheet.Range("F58").Value ' Constant value .MinimumScale = ActiveSheet.Range("F68").Value ' Constant Value With Chart(4).Axes(xlValue, xlPrimary) .MaximumScale = ActiveSheet.Range("F59").Value ' Constant value .MinimumScale = ActiveSheet.Range("F69").Value ' Constant Value End With End Sub
原文:https://stackoverflow.com/questions/19033142
最满意答案
第一个非常简单 - 因为每次迭代时归纳变量按固定量上升,您可以预先计算用作数组下标的任何归纳变量的最大值,并检查它是否不超过数组边界。 在执行循环之前,您需要执行一次,而不是在每次迭代时检查下标。
至于第二个,有很多例子(在各种语言中,包括Java)的循环不变和归纳变量循环 - 只有谷歌这些条款。
The first one is pretty simple - since induction variables go up by fixed amounts per iteration, you can pre-compute the maximum value for any induction variable used as an array subscript and check that it doesn't exceed the array bounds. You'd do this once, before executing the loop, rather than checking the subscript on each iteration.
As for the second, there are plenty of examples (in various languages, including Java) of loop-invariant and induction-variable loops out there - just Google for those terms.
相关问答
更多-
CFA考试的mock exam和sample exam的区别是什么[2022-07-20]
CFA mock exam 和sample exam都是CFA协会官方出版,sample和mock exam作为最后冲刺阶段模考。 mock exam是和正式考试试题结构、形式、考试范围都相似的试题。 sample exam是就所有的考试知识点的样题。 财萃建议如果有条件的话都去做做,对通过考试还是很有帮助的。 -
在线考试Web应用程序(Online exam web application)[2021-12-28]
记录用户在服务器上启动和完成的时间。 用户将不得不按下按钮来表示他们已经开始了考试,这可以触发服务器来标记开始时间; 当提交最终答案时,服务器可以记录所花费的总时间。 Record the time that the user started and finished on the server. The user will have to press a button to indicate that they've started the exam, which can trigger the serv ... -
编译器考试解释(Compilers Exam Explanation)[2022-10-22]
第一个非常简单 - 因为每次迭代时归纳变量按固定量上升,您可以预先计算用作数组下标的任何归纳变量的最大值,并检查它是否不超过数组边界。 在执行循环之前,您需要执行一次,而不是在每次迭代时检查下标。 至于第二个,有很多例子(在各种语言中,包括Java)的循环不变和归纳变量循环 - 只有谷歌这些条款。 The first one is pretty simple - since induction variables go up by fixed amounts per iteration, you can p ... -
简单解释异常?(Simple explanation of exceptions?)[2022-03-12]
通常,代码按指令流动。 因此,当您阅读该程序时,您可以看到每个指令一个接一个地跟随的位置。 CPU遵循此列表。 现在,正如名称所示,异常会中断此执行流程。 你已经举了一些例子。 只要发生了正常的指令流不能继续并且必须处理的事情,就会发生执行。 因此,异常基本上是一种通知操作系统或程序员发生错误的方法。 这可能是代码中的错误,也可能是故意的。 例如,除以零通常是一个错误。 访问无效指针也可能是一个错误,但它也可能是操作系统从磁盘交换内存页面的触发器。 程序停止运行,操作系统确保页面加载,然后重置代码以继续,就 ... -
什么是ezero的类型? 可以从数据声明中读取数据构造函数ezero的类型: ezero : Even 0表示它的类型为Even 0 。 是否有任何类型的Even 1条款? 不,没有。 这可以通过一个案例区分来看出:如果有一个术语,那么它将从两个构造函数中的任何一个开始。 因为它们具有特定的回报指数,所以它们必须与1统一。 ezero将强制执行1 = 0 esuc意味着有一个n 1 = 2+ n 这两种情况都是不可能的。 有多少个词是偶数2? 列出它们 只有一个: esuc ezero 。 通过类似于前一个 ...
-
练习考试题(Practice Exam Questions)[2023-09-07]
有错误吗? struct bodytp // Is there an error? { char *name; // If so, fix the error. int len; }; 不,没有错误。 它是一个有效的结构定义。 现在错误如下。:) 函数main应声明为 int main( void ) 虽然它不是一个错误,但是在函数调用之前会有更好的函数原型 keepname(&person , "Waterman"); 该程序具有未定义的行为,因为通过本地数组的地址分配了一个指向该 ... -
你认为0 < x < 10是什么意思? 它不检查x是否在0和10之间,如果这就是你的想法。 <是一个二元运算符,它遵循运算符评估规则(优先级和关联性)。 所以0 < x < 10实际上意味着(0 < x) < 10 。 你需要两张支票才能得到你想要的结果(留给你)。 What do you expect 0 < x < 10 to mean? It doesn't check whether x is between 0 and 10, if that's what you thought. < is a ...
-
function接受一些数字n和一个函数f :: a -> a ,并将该函数与其自身组合n次,返回另一个类型为a -> a函数。 当返回的函数应用于类型a的值时,结果基本上与在循环中执行f次数相同,使用每个前一步骤的输出作为下一步的输入。 如果最终参数是明确的,也许更容易看到相似性: function :: (Ord a, Num a) -> a -> (b -> b) -> b -> b function n f x | n > 0 = f (function (n-1) f x) | o ...
-
不同的解释(different explanation)[2021-12-27]
不知道为什么这是它的工作方式,但是,如果你在将$this分配给你的全局变量时删除$this前面的& ,它将起作用。 为了说明这一点,以下部分代码: $global_obj = null; class my_class { public $my_value; public function __construct() { global $global_obj; $global_obj = $this; } } $a = new my_class; $a- ... -
mysql在考试中获得学生排名(mysql get student rank in exam)[2023-10-06]
尝试将exam_id也放在子查询中。 (SELECT GROUP_CONCAT(summarks ORDER BY summarks DESC) FROM (SELECT SUM( marks_obtained_written + marks_obtained_oral + marks_obtained_classwork ) AS summarks FROM resul ...