请大家帮我“翻译”一下这个Excel里的VBS是什么意思,满意后再追加10分!谢谢了……
PrivateSubWorkbook_Open()DimiAsLongDimtimesAsLongDimjAsLongtimes=Range("S2")j=times*3...
Private Sub Workbook_Open()
Dim i As Long
Dim times As Long
Dim j As Long
times = Range("S2")
j = times * 31 + 30
Rows("31:2000").Select
Selection.Delete Shift:=xlUp
Rows("1:28").Select
Application.CutCopyMode = False
Selection.Copy
For i = 1 To times
ActiveWindow.SmallScroll down:=i * 31
Range("A" & i * 31).Select
ActiveSheet.Paste
Worksheets("sheet1").Range("M" & (i * 30 + 2 + i)).Value = Application.WorksheetFunction.RoundUp((10 + i) / 3, 0) & "0" & ((i Mod 3) + 1)
Next i
Set myrange2 = Range("A1:O" & j & "")
myrange2.Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$" & j & ""
End Sub 展开
Dim i As Long
Dim times As Long
Dim j As Long
times = Range("S2")
j = times * 31 + 30
Rows("31:2000").Select
Selection.Delete Shift:=xlUp
Rows("1:28").Select
Application.CutCopyMode = False
Selection.Copy
For i = 1 To times
ActiveWindow.SmallScroll down:=i * 31
Range("A" & i * 31).Select
ActiveSheet.Paste
Worksheets("sheet1").Range("M" & (i * 30 + 2 + i)).Value = Application.WorksheetFunction.RoundUp((10 + i) / 3, 0) & "0" & ((i Mod 3) + 1)
Next i
Set myrange2 = Range("A1:O" & j & "")
myrange2.Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$" & j & ""
End Sub 展开
展开全部
Private Sub Workbook_Open() 工作簿打开过程
Dim i As Long 定义I长整
Dim times As Long 定义TIMES长整
Dim j As Long 定义J长整
times = Range("S2") 将S2单元格的值赋值给TIMES
j = times * 31 + 30 计算J的值
Rows("31:2000").Select 行31到3000行选定
Selection.Delete Shift:=xlUp 删除之所选,上移
Rows("1:28").Select 1到28行选定
Application.CutCopyMode = False 好像是设置为不复制状态,应该是清空复制区域吧!
Selection.Copy 复制
For i = 1 To times 循环
ActiveWindow.SmallScroll down:=i * 31 窗口向下滚动I*31行
Range("A" & i * 31).Select 选中AX单元格,X为计算结果
ActiveSheet.Paste 粘贴,不知道这会不会报错,因为复制的是整行
Worksheets("sheet1").Range("M" & (i * 30 + 2 + i)).Value = Application.WorksheetFunction.RoundUp((10 + i) / 3, 0) & "0" & ((i Mod 3) + 1) 调用ROUNDUP函数向上去整并赋值吧,但是EXCEL有ROUNDUP函数么?
Next i 循环
Set myrange2 = Range("A1:O" & j & "") 定义
myrange2.Select 选择
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$" & j & "" 设置打印区域
End Sub
可能有错误的地方,等别人补充吧!
Dim i As Long 定义I长整
Dim times As Long 定义TIMES长整
Dim j As Long 定义J长整
times = Range("S2") 将S2单元格的值赋值给TIMES
j = times * 31 + 30 计算J的值
Rows("31:2000").Select 行31到3000行选定
Selection.Delete Shift:=xlUp 删除之所选,上移
Rows("1:28").Select 1到28行选定
Application.CutCopyMode = False 好像是设置为不复制状态,应该是清空复制区域吧!
Selection.Copy 复制
For i = 1 To times 循环
ActiveWindow.SmallScroll down:=i * 31 窗口向下滚动I*31行
Range("A" & i * 31).Select 选中AX单元格,X为计算结果
ActiveSheet.Paste 粘贴,不知道这会不会报错,因为复制的是整行
Worksheets("sheet1").Range("M" & (i * 30 + 2 + i)).Value = Application.WorksheetFunction.RoundUp((10 + i) / 3, 0) & "0" & ((i Mod 3) + 1) 调用ROUNDUP函数向上去整并赋值吧,但是EXCEL有ROUNDUP函数么?
Next i 循环
Set myrange2 = Range("A1:O" & j & "") 定义
myrange2.Select 选择
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$" & j & "" 设置打印区域
End Sub
可能有错误的地方,等别人补充吧!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询