将公式插入到单元格中的多行中 [英] Insert formula into multiple rows in excel from cell
问题描述
大家好,目前我正在开展一个excel项目。
我创建了一个名为 resetRow 的宏按钮。在单元格C10中键入行号并单击按钮后,列和用户定义的行将在电子表格中插入公式。
我想要实现的是能够在输入单元格(C10)中输入多个数字,而不是只输入一个数字。例如,如果我输入15,16,18,20-29,则行15,16,18和行20至29将具有插入其单元格中的公式。有没有人知道我应该怎么做呢?
昏暗 resetRow 作为 整数
resetRow =范围( C10)。值
范围( F&(resetRow)& :I &(resetRow))。公式= = G10_Anchor + short_end_increment *(base_year-F $ 57)
范围( K&(resetRow)& < span class =code-string> :L&(resetRow))。公式= = G10_Anchor + short_end_increment *(base_year-F $ 57)
范围( G10_anchor_range)。公式= = G10_Anchor
范围( CEE_anchor_range)。公式= = CEE_Anchor
范围( CEE_anchor_range)。公式= = CM_Anchor
结束 Sub
57)
范围( K& (resetRow)& :L& (resetRow))。公式= = G10_Anchor + short_end_increment *(base_year-F
Hello everyone, currently I am working on an excel project.
< blockquote> 57)
范围( G10_anchor_range)。公式= = G10_Anchor
范围( CEE_anchor_range)。公式= = CEE_Anchor
范围( CEE_anchor_range)。公式= = CM_Anchor
结束 子跨度>
I have created a button with the macro named resetRow. Upon typing in a row number in the cell C10 and clicking the button, the column and user-defined row will have a formula inserted into the spreadsheet.
What I want to achieve is to be able to type multiple numbers in the input cell (C10) instead of just one number. For example if I type "15,16,18, 20-29" the rows 15, 16, 18 and rows 20 to 29 will have formulas inserted into their cells. Does anyone have any idea how I should go about doing that?
Dim resetRow As Integer
resetRow = Range("C10").Value
Range("F" & (resetRow) & ":I" & (resetRow)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
Range("K" & (resetRow) & ":L" & (resetRow)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
Range("G10_anchor_range").Formula = "=G10_Anchor"
Range("CEE_anchor_range").Formula = "=CEE_Anchor"
Range("CEE_anchor_range").Formula = "=CM_Anchor"
End Sub
57)"
Range("K" & (resetRow) & ":L" & (resetRow)).Formula = "=G10_Anchor+short_end_increment*(base_year-F57)"
Range("G10_anchor_range").Formula = "=G10_Anchor"
Range("CEE_anchor_range").Formula = "=CEE_Anchor"
Range("CEE_anchor_range").Formula = "=CM_Anchor"
End Sub
这篇关于将公式插入到单元格中的多行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!