楼主: 月桥的雪
1351 4

[问答] 求解答!关于excel中的VBA程序问题! [推广有奖]

  • 1关注
  • 0粉丝

已卖:4份资源

高中生

62%

还不是VIP/贵宾

-

威望
0
论坛币
357 个
通用积分
0
学术水平
3 点
热心指数
3 点
信用等级
3 点
经验
1806 点
帖子
35
精华
0
在线时间
26 小时
注册时间
2013-7-16
最后登录
2015-8-17

楼主
月桥的雪 发表于 2013-7-31 16:51:39 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
下面是Excel VBA 一段程序,目的是要改变一些变量 withdraw, death_a_rate, comm_rate, invest_a_rate, fee, ex_rate这六个然后把改变后想要的数据结果 Worksheets("利润测试").Cells(10, l(这都是L)).Value 这里的 生成一张9行14列的表格。

但是到黄色那句就显示下标越界了!请问问题在哪怎么改啊!我刚学VBA。。
对能解决的感激涕零!

代码如下:

Dim age, f, c, i, e, w, d, h, l As Integer
Dim withdraw, death_a_rate, comm_rate, invest_a_rate, fee, ex_rate, result, database As Variant

withdraw = Array(1.5, 1.25, 0.75)
death_a_rate = Array(1.1, 0.9, 0.8)
comm_rate = Array(1.1, 1.05, 0.95)
invest_a_rate = Array(0.055, 0.045, 0.04)
fee = Array(1.5, 1.25, 0.75)
ex_rate = Array(1.2, 1.1, 0.9)
Range("scer").ClearContents
result = Range("scer").Value

For l(这是L) = 1 To 14
h = 2
For i = 0 To 2
Range("invest_rate_adjust").Value = invest_a_rate(i)
h = h + i
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("invest_rate_adjust").Value = 0
Next i
h = h + 1

For w = 0 To 2
Range("withdraw_adjust").Value = withdraw(w)
h = h + w
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("withdraw_adjust").Value = 1
Next w
h = h + 1

For d = 0 To 2
Range("death_rate_adjust").Value = death_a_rate(d)
h = h + d
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("death_rate_adjust").Value = 1
Next d
h = h + 1

For e = 0 To 2
Range("ex_adjust").Value = ex_rate(e)
h = h + e
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("ex_adjust").Value = 1
Next e
h = h + 1

For f = 0 To 2
Range("ave_prem_adjust").Value = fee(f)
h = h + f
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("ave_prem_adjust").Value = 1
Next f
h = h + 1

For c = 0 To 2
Range("comm_adjust").Value = comm_rate(c)
h = h + c
result(h, l) = Worksheets("利润测试").Cells(10, l).Value
Range("ave_prem_adjust").Value = 1
Next c
h = h + 1
Next l
Range("scer").Value = result


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:EXCEL xcel exce VBA cel excel 程序

沙发
月桥的雪 发表于 2013-7-31 17:01:50
自己顶一下,有看见会的帮帮忙哦!

藤椅
fftangwen 发表于 2013-7-31 17:05:10
上传附件吧,这看的累死了

板凳
月桥的雪 发表于 2013-7-31 17:17:38
fftangwen 发表于 2013-7-31 17:05
上传附件吧,这看的累死了
那个EXCEL不允许传的额。我也没有办法嘛。。。

报纸
月桥的雪 发表于 2013-7-31 17:22:27
fftangwen 发表于 2013-7-31 17:05
上传附件吧,这看的累死了
那个EXCEL不允许传的额。我也没有办法嘛。。。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 14:22