[英]VBA How to extend range of macro to entire sheet
How can I pass every value from combo box through a sheet and retrieve a single cell that will be stored on a separate sheet? 如何将组合框中的每个值传递给工作表并检索将存储在单独工作表中的单个单元格?
Sheet 1: Enter a Location from Combo Box (Stored on Sheet 2) and date to retrieve hourly temperature from external database for 90 days starting from date that was inputted. 第1页:从组合框输入位置(存储在第2页上),并从输入的日期开始90天内从外部数据库检索每小时温度。 Stores maximum value.
存储最大值。 Sheet 3: Need to go through each location and store max value next to Location name,
表格3:需要遍历每个位置并在“位置名称”旁边存储最大值,
Right now, My macro for one iteration is: 现在,我的一次迭代宏是:
ActiveWindow.SmallScroll Down:=-6
Range("B1").Select
Selection.NumberFormat = "General"
Range("B1").Select
ActiveCell.FormulaR1C1 = "='Load Book'!R[2]C[-1]"
Range("B2").Select
Sheets("Max Amps").Select
ActiveSheet.Calculate
Sheets("Load Book").Select
Range("B3").Select
Selection.NumberFormat = "0"
ActiveSheet.Calculate
This is only working for whatever is in that one cell. 这仅适用于该单元中的任何单元。 And if I try to record a macro for the next iteration too, the first maximum temperature changes to be whatever is in the second location too.
如果我也尝试为下一次迭代记录宏,则第一个最高温度也将变为第二个位置中的最高温度。 How can I get the max temperature store, then move to next location without first being affected?
如何获得最高温度存储,然后在不首先受到影响的情况下移至下一个位置? And how can I apply this to 400 locations?
我如何将其应用于400个地点?
First change the code 首先更改代码
ActiveWindow.SmallScroll Down:=-6
Range("B1").NumberFormat = "General"
Range("B1").FormulaR1C1 = "='Load Book'!R[2]C[-1]"
Sheets("Max Amps").Select
ActiveSheet.Calculate
Sheets("Load Book").Select
Range("B3").NumberFormat = "0"
ActiveSheet.Calculate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.