VBA语句集100句第1辑.txt

上传人:文库蛋蛋多 文档编号:2389314 上传时间:2023-02-17 格式:TXT 页数:11 大小:12.73KB
返回 下载 相关 举报
VBA语句集100句第1辑.txt_第1页
第1页 / 共11页
VBA语句集100句第1辑.txt_第2页
第2页 / 共11页
VBA语句集100句第1辑.txt_第3页
第3页 / 共11页
VBA语句集100句第1辑.txt_第4页
第4页 / 共11页
VBA语句集100句第1辑.txt_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《VBA语句集100句第1辑.txt》由会员分享,可在线阅读,更多相关《VBA语句集100句第1辑.txt(11页珍藏版)》请在三一办公上搜索。

1、- Page 1-ExcelVBAVBA 伯 VBA 伯 (1 ) (1) Option Explicit Option Private Module Option Compare Text Option Base 1 1 (2) On Error Resume Next VBA , (3) On Error GoTo ErrorHandler (4) On Error GoTo 0 (5) Application.DisplayAlerts=False (6) Application.ScreenUpdating=False Application.ScreenUpdating=True (

2、7) Application.Enable.CancelKey=xlDisabled Ctrl+Break (8) Workbooks.Add() (9) Workbooks( book1.xls).Activate book1 (10) ThisWorkbook.Save 湤 (11) ThisWorkbook.close (12) ActiveWorkbook.Sheets.Count (13) ActiveWorkbook.name (14) ThisWorkbook.Name ThisWorkbook.FullName (15) ActiveWindow.EnableResize=Fa

3、lse (16) Application.Window.Arrange xlArrangeStyleTiled (17) ActiveWorkbook.WindowState=xlMaximized (18) ActiveSheet.UsedRange.Rows.Count (19) Rows.Count () (20) Sheets( Sheet1).Name= Sum Sheet1 Sum - 1 - - Page 2-ExcelVBAVBA 伯 (21) ThisWorkbook.Sheets.Add Before:=Worksheets(1) (22) ActiveSheet.Move

4、 After:=ActiveWorkbook. _ Sheets(ActiveWorkbook.Sheets.Count) (23) Worksheets(Array( sheet1,sheet2).Select 1 2 (24) Sheets( sheet1).Delete Sheets(1).Delete 1 (25) ActiveWorkbook.Sheets(i).Name i (26) ActiveWindow.DisplayGridlines=Not ActiveWindow.DisplayGridlines (27) ActiveWindow.DisplayHeadings=No

5、t ActiveWindow.DisplayHeadings (28) ActiveSheet.UsedRange.FormatConditions.Delete (29) Cells.Hyperlinks.Delete (30) ActiveSheet.PageSetup.Orientation=xlLandscape ActiveSheet.PageSetup.Orientation=2 (31) ActiveSheet.PageSetup.RightFooter=ActiveWorkbook.FullName ActiveSheet.PageSetup.LeftFooter=Applic

6、ation.UserName / (32) ActiveCell.CurrentRegion.Select Range(ActiveCell.End(xlUp),ActiveCell.End(xlDown).Select (33) Cells.Select (34) Range( A1).ClearContents A1 Selection.ClearContents Range( A1:D4).Clear A1 D4 (35) Cells.Clear (36) ActiveCell.Offset(1,0).Select (37) Range( A1).Offset(ColumnOffset:

7、=1)Range( A1).Offset(,1) Range( A1).Offset(Rowoffset:=-1)Range( A1).Offset(-1) (38) Range( A1).Copy Range( B1) A1B1 - 2 - - Page 3-ExcelVBAVBA 伯 Range( A1:D8).Copy Range( F1) F1 Range( A1:D8).Cut Range( F1) A1 D8F1 Range( A1).CurrentRegion.Copy Sheets( Sheet2).Range( A1) A1 򵽹2 A1 CurrentRegi

8、on (39) ActiveWindow.RangeSelection.Value=XX XX (40) ActiveWindow.RangeSelection.Count (41) Selection.Count (42) GetAddress=Replace(Hyperlinkcell.Hyperlinks(1).Address,mailto:,) (43) TextColor=Range( A1).Font.ColorIndex 鵥A1 Range( A1).Interior.ColorIndex A1 (44) cells.count (45) Selection.Range( E4)

9、.Select 3 4 (46) Cells.Item(5,C) C5 Cells.Item(5,3) C5 (47) Range( A1).Offset(RowOffset:=4,ColumnOffset:=5) Range( A1).Offset(4,5) F5 (48) Range( B3).Resize(RowSize:=11,ColumnSize:=3) Rnage( B3).Resize(11,3) B3D13 (49) Range( Data).Resize(,2) Data 2 (50) Union(Range( Data1),Range( Data2) Data1 Data2

10、 (51) Intersect(Range( Data1),Range( Data2) Data1 Data2 (52) Range( Data).Count Data Range( Data). Columns.Count Data Range( Data). Rows.Count Data (53) Selection.Columns.Count Selection.Rows.Count (54) Selection.Areas.Count (55) ActiveSheet.UsedRange.Row (56) Rng.Column Rng (57) ActiveSheet.Cells.S

11、pecialCells(xlCellTypeAllFormatConditions) - 3 - - Page 4-ExcelVBAVBA 伯 (58) Range( A1).AutoFilter Field:=3,VisibleDropDown:=False 3 (59) Range( A1C3).Name= computer A1C3 computer Range( D1E6).Name= Sheet1!book Sheet1 D1 E6 book Names( computer).Name= robot computer robot (60) Names( book).Delete (6

12、1) Names.Add Name:= ContentList_ RefersTo:= =OFFSET(Sheet1!A2,0,0,COUNTA(Sheet2!$A:$A) (62) Names.Add Name:= Company,RefersTo:= CompanyCar CompanyCar (63) Names.Add Name:= Total,RefersTo:=123456 123456 Total (64) Names.Add Name:= MyArray,RefersTo:=ArrayNum ArrayNum MyArray (65) Names.Add Name:= Prod

13、uceNum,RefersTo:= =$B$1,Visible:=False (66) ActiveWorkbook.Names( Com).Name (67) Application.WorksheetFunction.IsNumber( A1) A1 (68) Range( A:A).Find(Application.WorksheetFunction.Max(Range( A:A).Activate A (69) Cells(8,8).FormulaArray= =SUM(R2C-1:R-1C-1*R2C:R-1C) 鹫R1C1 (70) ActiveSheet.ChartObjects

14、.Count (71) ActiveSheet.ChartObjects( Chart1).Select Chart1 (72) ActiveSheet.ChartObjects( Chart1).Activate ActiveChart.ChartArea.Select - 4 - - Page 5-ExcelVBAVBA 伯 (73) WorkSheets( Sheet1).ChartObjects( Chart2).Chart. _ ChartArea.Interior.ColorIndex=2 (74) Sheets( Chart2).ChartArea.Interior.ColorI

15、ndex=2 (75) Charts.Add (76) ActiveChart.SetSourceData Source:=Sheets( Sheet1).Range( A1:D5), _ PlotBy:=xlColumns (77) ActiveChart.Location Where:=xlLocationAsNewSheet (78) ActiveChart.PlotArea.Interior.ColorIndex=xlNone (79) WorkSheets( Sheet1).ChartObjects(1).Chart. _ Export FileName:= CMyChart.gif

16、,FilterName:= GIF 1 C MyChart.gif (80) MsgBox Hello! Hello (81) Ans=MsgBox( Continue?,vbYesNo) Ans vbYes񡱰Ans vbNo If MsgBox( Continue?,vbYesNo)vbYes Then Exit Sub (82) Config=vbYesNo+vbQuestion+vbDefaultButton2 Config (83) MsgBox This is the first line. & vbNewLine & Second line. vbCrLf vbNe

17、wLine (84) MsgBox the average is :&Format(Application.WorksheetFunction.Average(Selection),#,#0.00),vbInfor mation, selection count average & Chr(13) (85) Userform1.Show (86) Load Userform1 ,崦 (87) Userform1.Hide (88) Unload Userform1 Unload Me (89) ( ).Picture=LoadPicture( ) (90) UserForm1.Show 0 U

18、serForm1.Show vbModeless (91) Me.Height=Int(0.88*ActiveWindow.Height) 0.88 Me.Width=Int(0.88*ActiveWindow.Width) 0.88 - 5 - - Page 6-ExcelVBAVBA 伯 (92) Application.EnableEvents=False Application.EnableEvents=True (93) Set ExcelSheet = CreateObject(Excel.Sheet) Excel ExcelSheet.Application.Visible =

19、True Application Excel ExcelSheet.Application.Cells(1, 1).Value = Data ExcelSheet.SaveAs C:TEST.XLS 񱣴浽C:test.xls ExcelSheet.Application.Quit Excel Set ExcelSheet = Nothing (94) Excel Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.WorkSheet Set xlApp = Create

20、Object(Excel.Application) Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlBook.Worksheets(1) (95) Excel.Application Call MySub (CreateObject(Excel.Application) (96) Set d = CreateObject(Scripting.Dictionary) Dictionary (97) d.Add a, Athens (98) Application.OnKey I,macro Ctrl+I macro (99) Application.CutCopyMode=False / (100) Application.Volatile True Application.Volatile False By fanjy in 2006-6-4 - 6 -

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号