《VBA语句集100句第2辑.txt》由会员分享,可在线阅读,更多相关《VBA语句集100句第2辑.txt(9页珍藏版)》请在三一办公上搜索。
1、- Page 1-ExcelVBAVBA 伯 VBA 伯 (2 ) * (101) Err.Clear * (102) ThisWorkbook.BuiltinDocumentProperties(Last Save Time) Application.Caller.Parent.Parent.BuiltinDocumentProperties(Last Save Time) 湤 (103) ThisWorkbook.BuiltinDocumentProperties(Last Print Date) Application.Caller.Parent.Parent.BuiltinDocume
2、ntProperties(Last Print Date) (104) Workbooks.Close (105) ActiveWorkbook.LinkSources(xlExcelLinks)(1) (106) ActiveWorkbook.CodeName ThisWorkbook.CodeName (107) ActiveWorkbook.FileFormat ThisWorkbook.FileFormat (108) ThisWorkbook.Path ActiveWorkbook.Path (:,) (109) ThisWorkbook.ReadOnly Act
3、iveWorkbook.ReadOnly /(False) (110) ThisWorkbook.Saved ActiveWorkbook.Saved 洢(False) (111) Application.Visible = False Application.Visible = True :,,. * (112) ActiveSheet.Columns(B).Insert A B ActiveSheet.Columns(E).Cut ActiveSheet.Columns(B).Insert 佫E B B ActiveSheet.Columns(B).Cut ActiveS
4、heet.Columns(E).Insert 佫B D C D - 1 - - Page 2-ExcelVBAVBA 伯 (113) ActiveSheet.Calculate (114) ThisWorkbook.Worksheets(sheet1).Visible=xlSheetHidden Excel ThisWorkbook.Worksheets(sheet1).Visible=xlSheetVeryHidden Excel ThisWorkbook.Worksheets(sheet1).Visible=xlSheetVisible (115)
5、ThisWorkbook.Sheets(1).ProtectContents 鹤 (116) ThisWorkbook.Worksheets.Add Count:=2, _ Before:=ThisWorkbook.Worksheets(2) ThisWorkbook.Workshees.Add ThisWorkbook.Worksheets(2), , 2 (117) ThisWorkbook.Worksheets(3).Copy (118) ThisWorkbook.Worksheets(3).Copy ThisWorkbook.Worksheets(2) (119) ThisWorkbo
6、ok.ActiveSheet.Columns.ColumnWidth = 20 乤 20 ThisWorkbook.ActiveSheet.Columns.ColumnWidth = _ ThisWorkbook.ActiveSheet.StandardWidth ThisWorkbook.ActiveSheet.Columns(1).ColumnWidth = 20 乤1 20 (120) ThisWorkbook.ActiveSheet.Rows.RowHeight = 10 乤10 ThisWorkbook.ActiveSheet.Rows.RowHeight = _ ThisWorkb
7、ook.ActiveSheet.StandardHeight ThisWorkbook.ActiveSheet.Rows(1).RowHeight = 10 乤1 10 (121) ThisWorkbook.Worksheets(1).Activate (122) ThisWorkbook.Worksheets(Sheet1).Rows(1).Font.Bold = True Sheet1 1 (123) ThisWorkbook.Worksheets(Sheet1).Rows(1).Hidden = True Sheet1 1 ActiveCell.EntireRow.Hidden = Tr
8、ue (124) ActiveSheet.Range(A:A).EntireColumn.AutoFit A (125) ActiveSheet.Cells.SpecialCells(xlCellTypeConstants,xlTextValues) ActiveSheet.Cells.SpecialCells(xlCellTypeConstants,xlErrors+xlTextValues) * (126) Application.MacroOptions Macro:=SumPro,Category:=4 SumPro Excel (127) Application.MacroOptio
9、ns Macro:=SumPro, _ - 2 - - Page 3-ExcelVBAVBA 伯 Description:=First Sum,then Product 庯SumPro (128) Application.WorksheetFunction.CountA(Range(A:A)+1 A (129) WorksheetFunction.CountA(Cell.EntireColumn) WorksheetFunction.CountA(Cell.EntireRow) (130) WorksheetFunction.CountA(Cells) (131) ActiveSheet.Ra
10、nge(A20:D20).Formula=Sum(R-19C:R-1CA D 19 * (132) ActiveWindow.Visible=False ActiveChart.Deselect (133) TypeName(Selection)=Chart 棬 (134) ActiveSheet.ChartObjects.Delete ChartObject ActiveWorkbook.Charts.Delete * (135) UserForms.Add(MyForm).Show MyForm (136)TextName.SetFocus (137) SpinButton1.Value=
11、0 0 (138) TextBox1.Text=SpinButton1.Value SpinButton1.Value=Val(TextBox1.Text) CStr(SpinButton1.Value)=TextBox1.Text (139) UserForm1.Controls.Count UserForm1 (140) ListBox1.AddItem Command1 Command1 (141) ListBox1.ListIndex -1 (142) RefEdit1.Text RefEdit1.Text=ActiveWindow.RangeSelection.Address Ref
12、Edit Set FirstCell=Range(RefEdit1.Text).Range(A1) (143) Application.OnTime Now + TimeValue(00:00:15), myProcedure 15 myProcedure (144) ActiveWindow.ScrollColumn=ScrollBarColumns.Value ActiveWindow ScrollColumn ActiveWindow.ScrollRow=ScrollBarRows.Value ActiveWindow ScrollRow (145) UserForm1.ListBox1
13、.AddItem Sheets(Sheet1).Cells(1,1) A1 ListBox1.List=Product Product ListBox1 - 3 - - Page 4-ExcelVBAVBA 伯 ListBox1.RowSource=Sheet2!SumP Sheet2 SumP (146) ListBox1.Selected(0) ( Selected ) (147) ListBox1.RemoveItem ListBox1.ListIndex * Application (148) Application.UserName (149) Application.Caller
14、(150) Application.Caller.Parent.Parent (151) Application.StatusBar= Application.StatusBar= & Percent & % Completed Percent İ Application.StatusBar=False (152) Application.Goto Reference:=Range(A1:D4) A1 D4 A1 D4 (153) Application.Dialogs(xlDialogFormulaGoto).Show (154) Application
15、.Dialogs(xlDialogSelectSpecial).Show (155) Application.Dialogs(xlDialogFormatNumber).show Application.Dialogs(xlDialogAlignment).show Application.Dialogs(xlDialogFontProperties).show 塱 Application.Dialogs(xlDialogBorder).show Application.Dialogs(xlDialogPatterns).show Application.Dialogs(xlDialogCel
16、lProtection).show (156) Application.Dialogs(xlDialogFormulaGoto).show Range(b2), True () (157) Application.CommandBars(1).Controls(2).Controls(16).Execute (158) Application.Transpose(Array(Sun,Mon,Tur,Wed,Thu,Fri,Sat) (159) Application.Version Excel 汾 (160) Application.Cursor = xlNorthwestArrow Appl
17、ication.Cursor = xlIBeam Application.Cursor = xlWait () Application.Cursor = xlDefault (161) Application.WindowState - 4 - - Page 5-ExcelVBAVBA 伯 Application.WindowState = xlMinimized Application.WindowState = xlMaximized Application.WindowState = xlNormal (162) Application.UsableHeight Application.
18、UsableWidth (163) Application.ActiveCell.Address (:) (164) Application.ActivePrinter (165) Application.ActiveSheet.Name (166) Application.ActiveWindow.Caption (167) Application.ActiveWorkbook.Name (168) Application.Selection.Address (169) Application.ThisWorkbook.Name (170) Application.CalculationVe
19、rsion Excel 汾()Excel 汾() (171) Application.MemoryFree Excel ( ) (172) Application.MemoryUsed Excel (173) Application.MemoryTotal Excel ( ,MemoryFree MemoryUsed ) (174) Application.OperatingSystem 汾 (175) Application.OrganizationName Excel (176) Application.FindFormat Application.ReplaceFormat 滻 Acti
20、veSheet.Cells.Replace What:= , _ Replacement:= ,SearchFormat:=True,ReplaceFormat:=True 滻 (177) Application.Interactive=False (178) Application.Evaluate(Rate) 0.06 Rate, 佫0.06 (179) Application.OnUndo Undo Option,Undo Procedure UndoOption Undo Procedure * Range (180) Range(A1:A10).Value=App
21、lication.WorksheetFunction.Transpose(MyArray) 10 (A1 A10) (181) Range(A65536).End(xlUp).Row+1 A (182) rng.Range(A1) (183) cell.Parent.Parent.Worksheets (184) Selection.Font.Bold=Not Selection.Font.Bold (185) ActiveSheet.Range(A:B).Sort Key1:=Columns(B), Key2:=Columns(A), _ Header:=xlYes B A - 5 - -
22、Page 6-ExcelVBAVBA 伯 (186) cell.Range(A1).NumberFormat (187) cell.Range(A1).HasFormula 鵥 cell.HasFormula (188) Cell.EntireColumn Cell.EntireRow (189) rng.Name.Name rng (190) rng.Address rng (191) cell.Range(A1).Formula rng Formula (192) Range(D5:D10).Cells(1,1) D5:D10 (193) ActiveCell.Row ActiveCell
23、.Column (194) Range(A1:B1).HorizontalAlignment = xlLeft (195) ActiveSheet.Range(A2:A10).NumberFormat=#,#0 A2 A10 (196) rng.Replace ,0 0 滻 * Collection object (197) Dim colMySheets As New Collection Public colMySheets As New Collection (198) Set MyRange=Range(A1:A5) MyRange (199) .Add Cell.Value CStr(Cell.Value) ( ) * Windows API (200) Declare Function GetWindowsDirectoryA Lib kernel32 _ (ByVal lpBuffer As String,ByVal nSize As Long) As Long API Windows Windows lpBuffer nSize (By fanjy in 2006-6-24) - 6 -