我使用我录制了一个合并计算的宏,并把他的代码添加到控件按钮的代码中,结果一点击该控件按钮就提示“编译错误 缺少end sub”:
Private Sub CommandButton1_Click()
Sub Macro3()
'
' Macro3 Macro
' 宏由 微软用户 录制,时间: 2012-5-29
'
'
Range("G1").Select
Application.CutCopyMode = False
Selection.Consolidate Sources:= _
"'C:\Documents and Settings\Administrator\桌面\[新建 Microsoft Excel 工作表 (5).xls]Sheet1'!C4:C5" _
, Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
Range("H5").Select
ActiveSheet.Shapes("CommandButton1").Select
End Sub
End Sub
excel 编译错误 缺少end sub
答案:2 悬赏:0 手机版
解决时间 2021-12-23 04:18
- 提问者网友:城市野鹿
- 2021-12-23 00:34
最佳答案
- 五星知识达人网友:長槍戰八方
- 2021-12-23 01:40
Private Sub CommandButton1_Click()
Range("G1").Select
Application.CutCopyMode = False
Selection.Consolidate Sources:= _
"'C:\Documents and Settings\Administrator\桌面\[新建 Microsoft Excel 工作表 (5).xls]Sheet1'!C4:C5" _
, Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
Range("H5").Select
ActiveSheet.Shapes("CommandButton1").Select
End Sub
再去试一试!!!
Range("G1").Select
Application.CutCopyMode = False
Selection.Consolidate Sources:= _
"'C:\Documents and Settings\Administrator\桌面\[新建 Microsoft Excel 工作表 (5).xls]Sheet1'!C4:C5" _
, Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
Range("H5").Select
ActiveSheet.Shapes("CommandButton1").Select
End Sub
再去试一试!!!
全部回答
- 1楼网友:话散在刀尖上
- 2021-12-23 02:06
private sub xx_workbookopen(byval wb as workbook)
...
...
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯