VBA 从开始到放弃

debug de到脑壳疼,编程真的好难呀!
给自己定一个30天的学习计划,每天把熟练的代码以及弄不懂的问题记录在这里,每天进步一点点!

电脑上运行vba实在太费劲了!!!!!不玩了!

#1 累加器、计数器
1 | course | score |
2 | accouting | 90 |
3 | audit | 98 |
4 | IT audit | 95 |

Dim sum_score, num_c
'cells(x,2) add up to sum_score
	for x = 2 to 4'cells(2,2) to cells(4,2)
		sum_score = sum_score + cells(x,2)
		num_c = num_c + 1
	next x

#2 if判断语句

if score > 75 then
	level = "A"
elseif score > 60 then
	level = "B"
elseif score > 45 then
	level = "C"
else
	level = "D"
end if

#3 处理一个range里的数据
在这里插入图片描述

‘cells(x,y) ranges from cells(3,2) to cells(5,4)
	for x = 3 to 5
		for y = 2 to 4
			cells(x,y) = cells(x,y) * 100
		next y
	next x

#4 对于当前工作簿的每张工作表的A1单元格写入666

'x is the variance for the location of each worksheet
For x = 1 To Worksheets.count
    Set w = Worksheets(x)
    w.Cells(1, 1) = 666
Next x

#5 自动添加2张新工作表,且在新工作表的A1写入666

for x = 1 to 2
	set wa = worksheets.add
	wa.cells(1,1) = 666
next x

#6 workbook是lily的月度成绩表,每张worksheet是lily每次月考的成绩明细,将每张worksheet的成绩汇总

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值