首页 \ 问答 \ 根据表格更新折线图(Update line graph based on table)

根据表格更新折线图(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
更新时间:2023-07-30 09:07

最满意答案

第一个非常简单 - 因为每次迭代时归纳变量按固定量上升,您可以预先计算用作数组下标的任何归纳变量的最大值,并检查它是否不超过数组边界。 在执行循环之前,您需要执行一次,而不是在每次迭代时检查下标。

至于第二个,有很多例子(在各种语言中,包括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都是CFA协会官方出版,sample和mock exam作为最后冲刺阶段模考。   mock exam是和正式考试试题结构、形式、考试范围都相似的试题。   sample exam是就所有的考试知识点的样题。 财萃建议如果有条件的话都去做做,对通过考试还是很有帮助的。
  • 记录用户在服务器上启动和完成的时间。 用户将不得不按下按钮来表示他们已经开始了考试,这可以触发服务器来标记开始时间; 当提交最终答案时,服务器可以记录所花费的总时间。 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 ...
  • 第一个非常简单 - 因为每次迭代时归纳变量按固定量上升,您可以预先计算用作数组下标的任何归纳变量的最大值,并检查它是否不超过数组边界。 在执行循环之前,您需要执行一次,而不是在每次迭代时检查下标。 至于第二个,有很多例子(在各种语言中,包括Java)的循环不变和归纳变量循环 - 只有谷歌这些条款。 The first one is pretty simple - since induction variables go up by fixed amounts per iteration, you can p ...
  • 通常,代码按指令流动。 因此,当您阅读该程序时,您可以看到每个指令一个接一个地跟随的位置。 CPU遵循此列表。 现在,正如名称所示,异常会中断此执行流程。 你已经举了一些例子。 只要发生了正常的指令流不能继续并且必须处理的事情,就会发生执行。 因此,异常基本上是一种通知操作系统或程序员发生错误的方法。 这可能是代码中的错误,也可能是故意的。 例如,除以零通常是一个错误。 访问无效指针也可能是一个错误,但它也可能是操作系统从磁盘交换内存页面的触发器。 程序停止运行,操作系统确保页面加载,然后重置代码以继续,就 ...
  • 什么是ezero的类型? 可以从数据声明中读取数据构造函数ezero的类型: ezero : Even 0表示它的类型为Even 0 。 是否有任何类型的Even 1条款? 不,没有。 这可以通过一个案例区分来看出:如果有一个术语,那么它将从两个构造函数中的任何一个开始。 因为它们具有特定的回报指数,所以它们必须与1统一。 ezero将强制执行1 = 0 esuc意味着有一个n 1 = 2+ n 这两种情况都是不可能的。 有多少个词是偶数2? 列出它们 只有一个: esuc ezero 。 通过类似于前一个 ...
  • 有错误吗? 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 ...
  • 不知道为什么这是它的工作方式,但是,如果你在将$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- ...
  • 尝试将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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。