参考附件 Excel 电子表格 请给我一个解决方案
Refer the attachment Excel Spreadsheet please send me a solution
附图显示,单元格 F52 显示数字 6,从 1 到 200 不等,单元格 N77 显示值 1663 RS。随着数字的变化,1 到 200 钞票的钱也发生了变化。我需要在 200 行和 2 列中列出个人账单金额。
示例:
1 200
2 600
3 ..
4 ..
5 ..
6 1663
7 ..
etc
请帮我写宏代码,我是宏的新手。
你的问题非常模糊,但如果我理解正确,那么只要你在下面的情况下添加另一个 Sheet,下面的 sheet 就可以工作 "Result" :
Sub foo()
Dim ws As Worksheet: Set ws = Sheets("Sheet1") 'The sheet where you have to enter your data
Dim ws2 As Worksheet: Set ws2 = Sheets("Result") 'The sheet where the results will go
For i = 1 To 200
ws.Range("F52").Value = i 'change the value of F52 from 1 to 200 in a loop
ws2.Cells(i, 1).Value = i 'write the value in the sheet Result
ws2.Cells(i, 2).Value = ws.Range("N77") 'get the calculated value from N77
Next i
End Sub
附图显示,单元格 F52 显示数字 6,从 1 到 200 不等,单元格 N77 显示值 1663 RS。随着数字的变化,1 到 200 钞票的钱也发生了变化。我需要在 200 行和 2 列中列出个人账单金额。
示例:
1 200
2 600
3 ..
4 ..
5 ..
6 1663
7 ..
etc
请帮我写宏代码,我是宏的新手。
你的问题非常模糊,但如果我理解正确,那么只要你在下面的情况下添加另一个 Sheet,下面的 sheet 就可以工作 "Result" :
Sub foo()
Dim ws As Worksheet: Set ws = Sheets("Sheet1") 'The sheet where you have to enter your data
Dim ws2 As Worksheet: Set ws2 = Sheets("Result") 'The sheet where the results will go
For i = 1 To 200
ws.Range("F52").Value = i 'change the value of F52 from 1 to 200 in a loop
ws2.Cells(i, 1).Value = i 'write the value in the sheet Result
ws2.Cells(i, 2).Value = ws.Range("N77") 'get the calculated value from N77
Next i
End Sub