乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > Excel 怎么查看EXCEL中的宏代码-excel宏的代码,excel如何使用宏的代码

Excel 怎么查看EXCEL中的宏代码-excel宏的代码,excel如何使用宏的代码

作者:乔山办公网日期:

返回目录:excel表格制作


补充:看了一下你的截图, 不是调用其他过程的语句出错zhidao.应该是你的某个过程的单词拼写有问题.
你把光标移动到主程序,按F8单步执行看是哪句出错,主程序没错,再把光标移动到其他的宏再单步执行检查.依次看时哪里的问题.
Sub all()
第一个宏_黄
第三个宏_红
第二个宏_黑
End Sub

Sub 第一个宏_黄()
MsgBox "第一个宏"
End Sub

Sub 第二个宏_黑()
MsgBox "第二个宏"
End Sub

Sub 第三个宏_红()
MsgBox "第三个宏"
End Sub


第一步,把文件保存为 xlsm格式

第二步,录入宏,把下面的代码复制粘贴,保存宏,命名为qingkong

第三步,插入图片,右键指定上qingkong这个宏即可。


Sub qingkong()

Range("B9,B14,B19,B24,B29,B35,B40,B45,B50,B55").ClearContents

End Sub



5分少了,加分吧!

身边没有可用的office程序,试着写下吧:
sub macro1()

dim s1ce as string '记录表1中的CE列值e799bee5baa6e79fa5e98193e59b9ee7ad94366
dim s2ce as string '记录表2中的CE列值

dim s2r1 as string '记录表2中的顺序行值
dim s2r2 as string '记录表2中的查找行值

dim s1rn as integer '记录表1中的当前行号
dim s2rn as integer '记录表2中的当前行号
dim s3rn as integer '记录表3中的当前行号

s3rn=1

do '比较表1与表2的CE列值,并将相同的行复制到表3
s1ce=sheet1.range("C1").offset(s1rn,0).value
s1ce=s1ce & sheet1.range("E1").offset(s1rn,0).value
'取得表1中CE列值

do
s2ce=sheet1.range("C1").offset(s2rn,0).value
s2ce=s2ce & sheet1.range("E1").offset(s2rn,0).value
'取得表2中CE的值
if s1ce=s2ce then
sheet3.rows(s3rn).value=sheet1.rows(s1rn).value
s3rn=s3rn+1
sheet3.rows(s3rn).value=sheet2.rows(s2rn).value
s3rn=s3rn+1
end if '将表1和表2中重复的行复制到表3中
s2rn=s2rn+1
loop while s2ce<>""

s1rn=s1rn+1
loop while s1ce<>""

先做这么多,其中复制段可能有问题,因为我不太记得语法了.需要调试. 如果有兴趣, 可以追问,我找台可以用VBA的电脑再说.....

相关阅读

关键词不能为空
极力推荐
  • 如何用<em>EXCEL</em>生成<em>趋势</em>图-exce

  • 上面输入后,下面的图表就自动更新。excel是这么设计的。有什么问题吗?难道是不希望自动导入?excel怎么做趋势图" src="/uploads/tu/669.jpg" style="width: 400px; height: 267px;" />1、在WPS 表格中,

ppt怎么做_excel表格制作_office365_word文档_365办公网