标题:昨天问题解决,今天出现新问题,求高手解答
取消只看楼主
lx5656
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2015-4-15
结帖率:33.33%
 问题点数:0 回复次数:1 
昨天问题解决,今天出现新问题,求高手解答
第一个按钮代码
Private Sub Command1_Click()
Dim EXAPP As Excel.Application
Dim WB As Excel.Workbook
Dim sht As Excel.Worksheet
Set EXAPP = CreateObject("excel.application")
Set WB = EXAPP.Workbooks.Open("d:\成绩表.xls")
Set sht = WB.Worksheets("Sheet1")
Range("N2").Select
     ActiveCell.FormulaR1C1 = "=SUM(RC[-8]:RC[-1])"
    Range("N2").Select
    Selection.AutoFill Destination:=Range("N2:N641"), Type:=xlFillDefault
    Range("N2:N641").Select
    ActiveWindow.SmallScroll Down:=-9
Form1.Caption = sht.Range("B5").Value '从表格取值
'WB.Save'保存编辑后的文件
WB.Close
Set sht = Nothing
Set WB = Nothing
Set EXAPP = Nothing
End Sub
第二个按钮代码
Private Sub Command2_Click()
Dim EXAPP As Excel.Application
Dim WB As Excel.Workbook
Dim sht As Excel.Worksheet
Set EXAPP = CreateObject("excel.application")
Set WB = EXAPP.Workbooks.Open("d:\成绩表.xls")
Set sht = WB.Worksheets("总表")
sht.Range("U3").Select
ActiveCell.FormulaR1C1 = "=RANK(RC[-1],R3C20:R800C20)"
Set sht = Nothing
Set WB = Nothing
Set EXAPP = Nothing
End Sub
昨天问题解决了
但是如果在第二按钮中计算的加入ActiveCell.FormulaR1C1 = "=RANK(RC[-1],R3C20:R800C20)"这个公式计算就提示错误,问题所在不懂!求教高手解答。
搜索更多相关主题的帖子: 成绩表 
2015-05-20 10:49
lx5656
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2015-4-15
得分:0 
谢谢高手解答谢谢,万分感谢
2015-05-20 11:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-445523-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.429996 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved