简体   繁体   English

如何在Excel中告诉单元格包含整个行的总和

[英]How do i tell a cell to contain the sum of a entire row in excel

I would like to tell an excel sheet to put, for each row, the sum of the values between B and G cells in the H cell. 我想告诉一个excel工作表,为每一行放置H单元中B和G单元之间的值之和。

For exemple: H1 must contain the SUM(B1:G1) , H2 must contain SUM(B2:G2) ... 例如: H1 must contain the SUM(B1:G1)H2 must contain SUM(B2:G2) ...

I want to make this process automatic instead of specifying on each H cell that is the SUM of the corresponding values between B and G. 我想使此过程自动化,而不是在每个H单元中指定B和G之间的对应值的总和。

Thanks. 谢谢。

If you double-click the little black box in the bottom-right hand corner of the cell, excel will automatically replicate the contents of that cell to the bottom of your current list revelant to the cell references within the cell. 如果双击单元格右下角的小黑框,Excel会自动将该单元格的内容复制到当前列表的底部,该列表与该单元格中的单元格引用有关。 You can also click-and-drag the little black box to specify the range yourself 您也可以单击并拖动小黑框以自行指定范围

This block will fill the entire acvitvated sheet when ran. 运行时,此块将填充整个已填充的图纸。

Sub FillSums
   Dim I as Integer
   I=0

   While Err.Description = ""
       I=I+1

       Application.ActiveSheet.Range("H" & I).Formula = "=SUM(B" & I & ":G" & I & ")"
   Wend
End Sub    

Dim I as Integer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果特定列中的单元格有数据,如何告诉 Excel 宏删除整行? - How do I tell an excel macro to delete the entire row if cell in a specific column have data? 在Excel for Mac 2011中,如何根据该行中一个单元格中的值格式化整个行? - In Excel for Mac 2011 how do I format an entire row based on the value in one cell in that row? Excel 宏/VBA - 如果一列中的单元格为空,如何删除整行? - Excel Macro / VBA - How do I delete an entire row if a cell in one column is blank? 如何返回单个单元格值而不是整行。 Excel 到 Python Tkinter - How do I return an individual cell value instead of the entire row. Excel to Python Tkinter 如果行中的一个单元格包含错误,如何删除整行? - How do I delete an entire row if a cell in the row contains an error? 如何在整个列中用括号括住Excel单元格内容? - How do I enclose an Excel cell contents with parentheses for an entire column? 如何在Excel表格中搜索文本,然后删除整个行? - How do I search a excel table for a text and then delete that entire row? Excel:如何在第n个列中求和单元格值 - Excel: How do I sum cell values every nth colum 如果前一行中的相同单元格相同,如何在Excel中删除整行? - How to delete an entire row in Excel if same cell in preceding row is identical? 如何在 Excel 中对一行的可变部分求和? - How do I sum variable parts of a row in Excel?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM