乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>excel</em> <em>VBA</em>编辑,点击按钮,找

<em>excel</em> <em>VBA</em>编辑,点击按钮,找

作者:乔山办公网日期:

返回目录:excel表格制作


1、按alt+F11打开vba编辑器;

2、输入以下代码

Sub 行()
MsgBox "sheet1共有" & Sheet1.UsedRange.Rows.Count & "行记录。"
End Sub

3、点击运行。



Sub 绿色copy变为白色()
Dim rng
For Each rng In Range("a1:z100")
If rng.Interior.ColorIndex = 10 Then
rng.Interior.ColorIndex = 2
End If
Next
End Sub
查找区域为A1:Z100,根据实际修改
菜单 -视图 -工具栏- 窗体

在出来的工具栏选按纽,然后画一个按钮.

在出来的对话框里点新建

出来的宏
Sub 按钮1_单击()

End Sub

在中间加入代码
Sub 按钮1_单击()
sheet2.range("a1")=sheet1.range("a1")
End Sub

子易空间站 - Excel培训专家

sub test()
dim jgarr(1 to 1000) as string
dim jgJs as integer
for each mycell in sheets(“sheet1”).cells
if mycell.font.color=? then '?绿色的色号 自己查一下zhidao
jgjs=jgjs+1
jgarr(jgjs)=mycell.text
endif
next mycell
'输出结果
sheets("sheet2").activate
for i=1 to jgjs
cells(i,1)=jgarr(i)
next i
end sub
随手写了一下,没有调试过

相关阅读

  • 如何修改<em>excel单元格属性</em>

  • 乔山办公网excel表格制作
  • range,cell属性 名称 说明 AddIndent 返回或设置一个 Variant 值,它指明当单元格中文本的对齐方式为水平或垂直等距分布时,文本是否为自动缩进。 Address 返回一个 String 值,它代表宏语
关键词不能为空
极力推荐

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