Execl宏程序总结Word文档下载推荐.docx
- 文档编号:21508635
- 上传时间:2023-01-30
- 格式:DOCX
- 页数:20
- 大小:19.13KB
Execl宏程序总结Word文档下载推荐.docx
《Execl宏程序总结Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Execl宏程序总结Word文档下载推荐.docx(20页珍藏版)》请在冰豆网上搜索。
k=k+1
EndSub
endrow=Range("
B65536"
).End(xlUp).Row
Fori=endrowTo6Step-1
IfCells(i,3)="
"
AndCells(i,5)="
ThenCells(i,2)="
Next
EndSub
SubMacro6()
Macro6Macro
2012/9/24
Ctrl+x
MsgBoxWorksheets.Count
Range("
C3:
J3"
).Select
Selection.Borders(xlDiagonalDown).LineStyle=xlNone
Selection.Borders(xlDiagonalUp).LineStyle=xlNone
Selection.Borders(xlEdgeLeft).LineStyle=xlNone
Selection.Borders(xlEdgeTop).LineStyle=xlNone
Selection.Borders(xlEdgeBottom).LineStyle=xlNone
Selection.Borders(xlEdgeRight).LineStyle=xlNone
Selection.Borders(xlInsideVertical).LineStyle=xlNone
Selection.Borders(xlInsideHorizontal).LineStyle=xlNone
A6:
K37"
WithSelection.Font
.Size=9
.Strikethrough=False
.Superscript=False
.Subscript=False
.OutlineFont=False
.Shadow=False
.Underline=xlUnderlineStyleNone
.ColorIndex=1
EndWith
M37"
WithSelection.Borders(xlEdgeLeft)
.LineStyle=xlContinuous
.Weight=xlThin
.ColorIndex=xlAutomatic
WithSelection.Borders(xlEdgeTop)
WithSelection.Borders(xlEdgeBottom)
WithSelection.Borders(xlEdgeRight)
WithSelection.Borders(xlInsideVertical)
WithSelection.Borders(xlInsideHorizontal)
Columns("
A:
A"
).ColumnWidth=3
B:
B"
).ColumnWidth=6.63
E:
E"
).ColumnWidth=5.88
F:
F"
).ColumnWidth=6
I:
I"
).ColumnWidth=7.5
J:
J"
).ColumnWidth=7.75
M:
M"
).ColumnWidth=7.13
Rows("
1:
1"
).RowHeight=15
2:
2"
).RowHeight=44.25
4:
4"
).RowHeight=24.75
6:
6"
).RowHeight=63
).RowHeight=66
Fori=6To36
Rows(i&
"
:
&
i).RowHeight=16.5
Next
SubMacro3()
Macro3Macro
2012/9/23
Fori=36To6Step-1
IfCells(i,8)<
>
Then
Cells(i,5)="
Cells(i,3)="
Else
Cells(i,2)="
EndIf
IfCells(3,9)<
Sheets(k).Name=Cells(3,9)
IfCells(3,9)<
Sheets(k).Name=Cells(3,10)
ExitSub
2012/9/20
k=1'
C36"
A=0
B=0
Ifendrow>
8Then
Fori=16To6Step-1
IfA=0Then
IfCells(i,3)<
Cells(i,3).Select
A=Selection.Value
B=Selection.Value
IfB>
AThen
ExitSub
IfErr.Number<
0Then
Err.Clear
OnErrorResumeNext
setr=cells.find()
ifrisnothingthen
exitsub
else
你的代码
endif
插入一个模块粘贴以下代码
SubSS()
DimMyFile,MyPathAsString
DimrngAsRange
istr=ThisWorkbook.Sheets("
sheet1"
).Range("
A1"
).Value
MyPath="
C:
\"
arr=Split("
456.xls,789.xls"
"
"
)
n=0
Do
OnErrorResumeNext
MyFile=arr(n)
Workbooks.Open(MyPath&
MyFile)
Setrng=Workbooks(MyFile).Sheets("
).UsedRange.Find(istr)
IfNotrngIsNothingThen
ThisWorkbook.Sheets("
).Rows
(2).Value=Workbooks(MyFile).Sheets("
).Rows(rng.Row).Value
Workbooks(MyFile).Close
n=n+1
LoopWhilen<
=1
MsgBox"
Nothing"
ActiveCell.FormulaR1C1="
6/1/2011"
Selection.AutoFillDestination:
=Range("
A1:
A30"
),Type:
=xlFillDefault
ActiveWindow.SmallScrollDown:
=-9
Selection.NumberFormatLocal="
m/d;
@"
WithSelection
.HorizontalAlignment=xlCenter
.VerticalAlignment=xlCenter
.WrapText=False
.Orientation=0
.AddIndent=False
.IndentLevel=0
.ShrinkToFit=False
.ReadingOrder=xlContext
.MergeCells=False
属性的调整
Range("
I5"
.Name="
宋体"
EndWith
J5格涮成H5
J5"
Selection.Copy
H5"
Selection.PasteSpecialPaste:
=xlPasteFormats,Operation:
=xlNone,_
SkipBlanks:
=False,Transpose:
=False
Application.CutCopyMode=False
外框有没有
Selection.Borders(xlDiagonalDown).LineStyle=xlNone
连续选择
H5:
M5,2:
).Select第二行
间隔选择
F17,H17,H21,E23,E16,C16,C23"
运行宏程序
Application.Run"
Book1.xls!
Macro1"
新建表格
Sheets.Add.Name="
xinjian"
当前数据
Selection.Value
当前数据=ActiveCell
Row_Max=Worksheets
(1).UsedRange.Rows.最大行数
∙DimarAsRange
ForEacharInSelection.Areas选择的区域
ar.Value=ar.Value公式数值转换成数值
Nextar
ActiveWindow.SmallScrollDown:
=3鼠标滚动
C6:
0.0_"
一位有效数字
数组
DimxAsLong,yAsLong
Dimarr(1To10,1To3)'
创建一个可以容下10行3列的数组空间
Forx=1To4
Fory=1To3
arr(x,y)=Cells(x,y)'
通过循环把单元格区域a1:
c4的数据装进数组中
Nexty
Nextx
MsgBoxarr(4,3)'
根据提供的行数和列数显示数组
arr(1,2)="
我改一下试试"
'
你可以随时修改数组内指定位置的数据
MsgBoxarr(1,2)
ARR=Application.Transpose(Range("
a1:
a3"
))‘用转置的方法,把单元格一列数据转换成一维数组
Subtest()
Dimx(1To11)AsSingle
Dimy(1To11)AsSingle
DimiAsInteger
n=1
Fori=-10To10Step2
x(n)=i
Cells(n,8)=x(n)
y(n)=x(n)^3+x(n)^2+x(n)
Cells(n,9)=y(n)
n=n+1
最小化
Application.WindowState=xlMinimized
取得焦点
Windows("
4月自卸汽车IAI-062xls.xls"
).Activate
选中当前(活动)单元格左边第10个单元格。
ActiveCell.Offset(0,-10)
range("
).offset
(1)即向下偏移一行
Selection.offset(0,1)=Workbooks("
Book1.xls"
).worksheets("
选择第三个深水井,选择BVB903
Selection.AutoFilterField:
=3,Criteria1:
="
BVB903"
给活动的单元格赋值
ActiveCell.FormulaR1C1=<
值>
得到指定单元格中的值
<
单元格地址>
).Text
插入单元格
Selection.InsertShift:
=xlToRight
‘在当前选中单元格的位置插入单元格并将当前选中的单元格向右移动
=xlDown
‘在当前选中单元格的位置插入单元格并将当前选中的单元格向下移动
Selection.EntireRow.Insert
‘在当前选中单元格的上面插入一行
Selection.EntireColumn.Insert
‘在当前选中单元格的左侧插入一列
设置字体名称和大小
Selection.Font.Name=<
字体名称>
Selection.Font.Size=<
字号>
Selection.Font.Bold=<
True/False>
‘加粗
Selection.Font.Italic=<
‘斜体
Selection.Font.ColorIndex=<
0到56之间的数字>
Selection.Font.Color=<
RGB值>
清空选中单元格里的内容
Selection.ClearContents
删除选中的单元格
Selection.Delete<
XlDirection值>
Selection.EntireRow.Delete
Selection.EntireColumn.Delete
得到当前EXCEL的文件名
ThisWorkbook.Path
‘文件路径
ThisWorkbook.Name
‘文件名
ThisWorkbook.FullName
‘全路径
ActiveWorkbook.SaveAs(ThisWorkbook.Path&
s&
.xls"
添加批注
).AddComment("
Writesthecontentinhere!
B1"
).Comment.TextText:
="
修改批注
显示/隐藏批注
Comment.Visible=<
True/False>
删除批注
ClearComments
Selection.Cut
‘剪切
Selection.Copy
‘复制
ActiveSheet.Paste
‘粘贴
公式赋值
ActiveCell.Formula="
=AVERAGE(R[-6]C[-4]:
R[-2]C[-4])"
E10"
).Formula="
=SUM(Sheet1!
R1C1:
R4C1)"
Worksheets("
Sheet1"
).ActiveCell.Formula="
=Max('
1-1剖面'
!
D3:
D5)"
Dim
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Execl 程序 总结
![提示](https://static.bdocx.com/images/bang_tan.gif)