vba 将多个单元格乘以另一个数字的最快方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/809725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:45:20  来源:igfitidea点击:

What's the quickest way to multiply multiple cells by another number?

excelvbaexcel-vbaexcel-formula

提问by jonty

If I have a block of cells such as A1:D5, what's the quickest way of multiplying each cell by another number, 1.1 using Microsoft Excel?

如果我有一个单元格块,例如 A1:D5,使用 Microsoft Excel 将每个单元格乘以另一个数字 1.1 的最快方法是什么?

采纳答案by JP Alioto

Are you asking how to do it in excel or how to do it in a VBA application? If you just want to do it in excel, here is one way.

您是在问如何在 excel 中执行此操作还是如何在 VBA 应用程序中执行此操作?如果您只想在 excel 中执行此操作,这是一种方法。

回答by Joel Spolsky

  1. Enter the multiplier in a cell
  2. Copy that cell to the clipboard
  3. Select the range you want to multiply by the multiplier
  4. (Excel 2003 or earlier) Choose Edit| Paste Special| Multiply

    (Excel 2007 or later) Click on the Paste down arrow | Paste Special| Multiply

  1. 在单元格中输入乘数
  2. 将该单元格复制到剪贴板
  3. 选择要乘以乘数的范围
  4. (Excel 2003 或更早版本)选择编辑| 粘贴特辑|

    (Excel 2007 或更高版本)单击粘贴向下箭头 | 粘贴特辑|

回答by Dr. D. Shridhar

To multiply a column of numbers with a constant(same number), I have done like this.

要将一列数字与一个常数(相同的数字)相乘,我是这样做的。

Let C2to C12be different numbers which need to be multiplied by a single number (constant). Then type the numbers from C2to C12.

C2C12是需要由单个数字(常数)乘以不同的号码。然后键入从C2到 C12的数字。

In D2type 1 (unity) and in E2 type formula =PRODUCT(C2:C12,CONSTANT). SELECT RIGHT ICON TO APPLY. NOW DRAG E2THROUGH E12. YOU HAVE DONE IT.

D2类型 1(统一)和E2 type formula =PRODUCT(C2:C12,CONSTANT). 选择正确的图标进行应用。现在拖动E2THROUGH E12。你已经做到了。

C       D       E=PRODUCT(C2:C12,20)

25  1   500
30      600
35      700
40      800
45      900
50      1000
55      1100
60      1200
65      1300
70      1400
75      1500

回答by Mike Lewis

Put the number you want to multiply by in a cell that is not in your range. Select the cell and "Copy" it to the clipboard. Next, select the Range A1:D5, and from the menu choose Edit|Paste Special. A dialog box will appear. In the "Operation" area, select "Multiply" and click "OK".

将您要乘以的数字放在不在您范围内的单元格中。选择单元格并将其“复制”到剪贴板。接下来,选择范围 A1:D5,然后从菜单中选择 Edit|Paste Special。将出现一个对话框。在“操作”区域中,选择“乘法”并单击“确定”。

回答by user5685970

Select Productfrom formula bar in your answer cell.

Product从答案单元格的公式栏中选择。

Select cells you want to multiply.

选择要相乘的单元格。

回答by Blorgbeard is out

If it doesn't need to be a macro, then just put =A1*1.1into (say) D7, then drag the formula fill handle across, then down.

如果它不需要是一个宏,那么只需放入=A1*1.1(比如)D7,然后拖动公式填充手柄,然后向下拖动。

回答by kdammers11

As one of the answers above says: " then drag the formula fill handle." This KEY feature is not mentioned in MS's explanation, nor in others here. I spent over an hour trying to follow the various instructions, to no avail. This is because you have to click and hold near the bottom of the cell just right (and at least on my computer that is not at all easy) so that a sort of "handle" appears. Once you're luck enough to get that, then carefully slide ["drag"] your cursor down to the lowermost of the cells you want to be multiplied by the constant. The products should show up in each cell as you move down. Just dragging down will give you only the answer in the first cell and a lot of white space.

正如上面的答案之一所说:“然后拖动公式填充手柄。” MS 的解释中没有提到这个 KEY 功能,这里的其他人也没有提到。我花了一个多小时试图按照各种说明进行操作,但无济于事。这是因为您必须在单元格底部附近单击并按住(至少在我的计算机上这并不容易),以便出现一种“手柄”。一旦你足够幸运,然后小心地将光标向下滑动 ["drag"] 到要乘以常数的单元格的最下方。当您向下移动时,产品应显示在每个单元格中。只需向下拖动只会在第一个单元格和大量空白处为您提供答案。