¹F¤HÁ`µ²ªºVBAºë¨åªº""¤K""Ãþ¦Ê±ø»y¥yª©
- ©«¤l
- 1572
- ¥DÃD
- 16
- ºëµØ
- 2
- ¿n¤À
- 1521
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- office 2003
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2016-1-13
|
¥»©«³Ì«á¥Ñ oobird ©ó 2012-4-15 11:26 ½s¿è
§âµü·J§ï¤@¤U
¤@¡G©w»s¼Ò²Õ¦æ¬°
(1) Option Explicit '±j¨î¹ï¼Ò²Õ¤º©Ò¦³Åܼƶi¦æÁn©ú
Option Private Module '¼Ð°O¼Ò²Õ¬°¨p¦³¡A¶È¹ï¦P¤@±M®×¤¤¨ä¥¦¼Ò²Õ¦³¥Î¡A¦b¥¨¶°¹ï¸Ü®Ø¤¤¤£Åã¥Ü
Option Compare Text '¦r²Å¦ê¤£°Ï¤À¤j¤p¼g
Option Base 1 '«ü©w°}¦Cªº²Ä¤@Ó¤U¼Ð¬°1
(2) On Error Resume Next '©¿²¤¿ù»~Ä~Äò°õ¦CVBA¥N½X,ÁקK¥X²{¿ù»~«H®§
(3) On Error GoTo ErrorHandler '·í¿ù»~µo¥Í®É¸õÂà¨ìµ{§Ç¤¤ªº¬YÓ¦ì¸m
(4) On Error GoTo 0 '«ì´_¥¿±`ªº¿ù»~´£¥Ü
(5) Application.DisplayAlerts=False '¦bµ{§Ç°õ¦Cµ{§Ç¤¤¨Ï¥X²{ªºÄµ§i®Ø¤£Åã¥Ü
(6) Application.ScreenUpdating=False 'Ãö³¬¼ü¹õ§ó·s
Application.ScreenUpdating=True '¥´¶}¼ü¹õ§ó·s
(7) Application.Enable.CancelKey=xlDisabled '¸T¥ÎCtrl+Break¤¤¤î¥¨¶°¹B¦æªº¥\¯à
¤G¡G¾Þ§@¬¡¶Ã¯
(8) Workbooks.Add() '³Ð«Ø¤@Ó·sªº¬¡¶Ã¯
(9) Workbooks("book1.xls").Activate '¿ï¤¤¦W¬°book1ªº¬¡¶Ã¯
(10) ThisWorkbook.Save '«O¦s¬¡¶Ã¯
(11) ThisWorkbook.close 'Ãö³¬·í«e¬¡¶Ã¯
(12) ActiveWorkbook.Sheets.Count 'Àò¨ú¬¡°Ê¬¡¶Ã¯¤¤¤u§@ªí¼Æ
(13) ActiveWorkbook.name '¨ú±o¬¡°Ê¬¡¶Ã¯ªº¦WºÙ
(14) ThisWorkbook.Name '¨ú±o·í«e¬¡¶Ã¯¦WºÙ
ThisWorkbook.FullName '¨ú±o·í«e¬¡¶Ã¯¸ô®|©M¦WºÙ
(15) ActiveWindow.EnableResize=False '¸T¤î½Õ¾ã¬¡°Ê¬¡¶Ã¯ªº¤j¤p
(16) Application.Window.Arrange xlArrangeStyleTiled '±N¬¡¶Ã¯¥H¨Ã±Æ¤è¦¡±ÆÄæ
(17) ActiveWorkbook.WindowState=xlMaximized '±N·í«e¬¡¶Ã¯³Ì¤j¤Æ
¤T¡G¾Þ§@¤u§@ªí
(18) ActiveSheet.UsedRange.Rows.Count '·í«e¤u§@ªí¤¤¤w¨Ï¥Îªº¦C¼Æ
(19) Rows.Count 'Àò¨ú¤u§@ªíªºÄæ¼Æ(µù¡G¦Ò¼{¦V«eÝ®e©Ê)
(20) Sheets(Sheet1).Name= "Sum" '±NSheet1©R¦W¬°Sum
(21) ThisWorkbook.Sheets.Add Before:=Worksheets(1) '²K¥[¤@Ó·s¤u§@ªí¦b²Ä¤@¤u§@ªí«e
(22) ActiveSheet.Move After:=ActiveWorkbook. _
Sheets(ActiveWorkbook.Sheets.Count) '±N·í«e¤u§@ªí²¾¦Ü¤u§@ªíªº³Ì«á
(23) Worksheets(Array("sheet1","sheet2")).Select '¦P®É¿ï¾Ü¤u§@ªí1©M¤u§@ªí2
(24) Sheets("sheet1").Delete©Î Sheets(1).Delete '§R°£¤u§@ªí1
(25) ActiveWorkbook.Sheets(i).Name 'Àò¨ú¤u§@ªíiªº¦WºÙ
(26) ActiveWindow.DisplayGridlines=Not ActiveWindow.DisplayGridlines '¤Á´«¤u§@ªí¤¤ªººô®æ½uÅã¥Ü¡A³oºØ¤èªk¤]¥i¥H¥Î¦b¨ä¥¦¤è±¶i¦C¬Û¤¬¤Á´«¡A§Y¬Û·í©ó¶}Ãö«ö¶s
(27) ActiveWindow.DisplayHeadings=Not ActiveWindow.DisplayHeadings '¤Á´«¤u§@ªí¤¤ªºÄæ¦CÃä®ØÅã¥Ü
(28) ActiveSheet.UsedRange.FormatConditions.Delete '§R°£·í«e¤u§@ªí¤¤©Ò¦³ªº±ø¥ó®æ¦¡
(29) Cells.Hyperlinks.Delete '¨ú®ø·í«e¤u§@ªí©Ò¦³¶W³sµ²
(30) ActiveSheet.PageSetup.Orientation=xlLandscape
©ÎActiveSheet.PageSetup.Orientation=2 '±N¶±³]¸m§ó§ï¬°¾î¦V
(31) ActiveSheet.PageSetup.RightFooter=ActiveWorkbook.FullName '¦b¶±³]¸mªºªí§À¤¤¿é¤J¤å¥ó¸ô®|
ActiveSheet.PageSetup.LeftFooter=Application.UserName '±N¥Î¤á¦W©ñ¸m¦b¬¡°Ê¤u§@ªíªº¶§À
¥|¡GÀx¦s®æ/Àx¦s®æ°Ï°ì
(32) ActiveCell.CurrentRegion.Select
©ÎRange(ActiveCell.End(xlUp),ActiveCell.End(xlDown)).Select
¿ï¾Ü·í«e¬¡°ÊÀx¦s®æ©Ò¥]§tªº½d³ò¡A¤W¤U¥ª¥kµLªÅ¦C
(33) Cells.Select '¿ï©w·í«e¤u§@ªíªº©Ò¦³Àx¦s®æ
(34) Range("A1").ClearContents '²M°£¬¡°Ê¤u§@ªí¤WÀx¦s®æA1¤¤ªº¤º®e
Selection.ClearContents '²M°£¿ï©w°Ï°ì¤º®e
Range("A1:D4").Clear '¹ý©³²M°£A1¦ÜD4Àx¦s®æ°Ï°ìªº¤º®e¡A¥]¬A®æ¦¡
(35) Cells.Clear '²M°£¤u§@ªí¤¤©Ò¦³Àx¦s®æªº¤º®e
(36) ActiveCell.Offset(1,0).Select '¬¡°ÊÀx¦s®æ¤U²¾¤@¦C¡A¦P²z¡A¥i¤U²¾¤@Äæ
(37) Range("A1").Offset(ColumnOffset:=1)©ÎRange("A1").Offset(,1) '°¾²¾¤@Äæ
Range("A1").Offset(Rowoffset:=-1)©ÎRange("A1").Offset(-1) '¦V¤W°¾²¾¤@¦C
(38) Range("A1").Copy Range("B1") '½Æ»sÀx¦s®æA1¡AÖ߶K¨ìÀx¦s®æB1¤¤
Range("A1:D8").Copy Range("F1") '±NÀx¦s®æ°Ï°ì½Æ»s¨ìÀx¦s®æF1¶}©lªº°Ï°ì¤¤
Range("A1:D8").Cut Range("F1") '°Å¤ÁÀx¦s®æ°Ï°ìA1¦ÜD8¡A½Æ»s¨ìÀx¦s®æF1¶}©lªº°Ï°ì¤¤
Range("A1").CurrentRegion.Copy Sheets("Sheet2").Range("A1") '½Æ»s¥]§tA1ªºÀx¦s®æ°Ï°ì¨ì¤u§@ªí2¤¤¥HA1°_©lªºÀx¦s®æ°Ï°ì¤¤
µù¡GCurrentRegionÄݩʬ۹ï©ó"½s¿è~¨ì"©R¥O¡A¥Ñ¤@Ó¯x§ÎÀx¦s®æ¶ô²Õ¦¨¡A©P³ò¬O¤@өΦhӪŦC©ÎÄæ
(39) ActiveWindow.RangeSelection.Value=XX '±NÈXX¿é¤J¨ì©Ò¿ïÀx¦s®æ°Ï°ì¤¤
(40) ActiveWindow.RangeSelection.Count '¬¡°Êµ¡¤f¤¤¿ï¾ÜªºÀx¦s®æ¼Æ
(41) Selection.Count '·í«e¿ï¤¤°Ï°ìªºÀx¦s®æ¼Æ
(42) GetAddress=Replace(Hyperlinkcell.Hyperlinks(1).Address,mailto:,"") '¨ú±oÀx¦s®æ¤¤¶W¯ÅÃì±µªº¦a§}¨Ã½áÈ
(43) TextColor=Range("A1").Font.ColorIndex 'ÀˬdÀx¦s®æA1ªº¤å¥»ÃC¦â¨Ã¨ú±oÃC¦â¯Á¤Þ
Range("A1").Interior.ColorIndex 'Àò¨úÀx¦s®æA1I´º¦â
(44) cells.count '¨ú±o·í«e¤u§@ªíªºÀx¦s®æ¼Æ
(45) Selection.Range("E4").Select '¿ï¤¤·í«e¬¡°ÊÀx¦s®æ¤U¤è3¦C¡A¦V¥k4Ä檺Àx¦s®æ
(46) Cells.Item(5,"C") '¤ÞÀx¦s®æC5
Cells.Item(5,3) '¤ÞÀx¦s®æC5
(47) Range("A1").Offset(RowOffset:=4,ColumnOffset:=5)
©Î Range("A1").Offset(4,5) '«ü©wÀx¦s®æF5
(48) Range("B3").Resize(RowSize:=11,ColumnSize:=3)
Rnage("B3").Resize(11,3) '³Ð«ØB3¡GD13°Ï°ì
(49) Range("Data").Resize(,2) '±NData°Ï°ìÂX¥R2Äæ
(50) Union(Range("Data1"),Range("Data2")) '±NData1©MData2°Ï°ì³s±µ
(51) Intersect(Range("Data1"),Range("Data2")) '¨ú±oData1©MData2°Ï°ìªº¥æ¤e°Ï°ì
(52) Range("Data").Count 'Àx¦s®æ°Ï°ìData¤¤ªºÀx¦s®æ¼Æ
Range("Data"). Columns.Count 'Àx¦s®æ°Ï°ìData¤¤ªºÄæ¼Æ
Range("Data"). Rows.Count 'Àx¦s®æ°Ï°ìData¤¤ªº¦C¼Æ
(53) Selection.Columns.Count '·í«e¿ï¤¤ªºÀx¦s®æ°Ï°ì¤¤ªºÄæ¼Æ
Selection.Rows.Count '·í«e¿ï¤¤ªºÀx¦s®æ°Ï°ì¤¤ªº¦C¼Æ
(54) Selection.Areas.Count '¿ï¤¤ªºÀx¦s®æ°Ï°ì©Ò¥]§tªº°Ï°ì¼Æ
(55) ActiveSheet.UsedRange.Row 'Àò¨úÀx¦s®æ°Ï°ì¤¤¨Ï¥Îªº²Ä¤@¦Cªº¦C¸¹
(56) Rng.Column 'Àò¨úÀx¦s®æ°Ï°ìRng¥ª¤W¨¤Àx¦s®æ©Ò¦bÄæ½s¸¹
(57) ActiveSheet.Cells.SpecialCells(xlCellTypeAllFormatConditions) '¦b¬¡°Ê¤u§@ªí¤¤¨ú±o©Ò¦³²Å¦X±ø¥ó®æ¦¡³]¸mªº°Ï°ì
(58) Range("A1").AutoFilter Field:=3,VisibleDropDown:=False 'Ãö³¬¥Ñ©ó°õ¦C¦Û°Ê¿z¿ï©R¥O²£¥Íªº²Ä3Ó¦r¬qªº¤U©ÔÄæªí¦WºÙ
(59) Range("A1¡GC3").Name="computer" '©R¦WA1¡GC3°Ï°ì¬°computer
©ÎRange("D1¡GE6").Name="Sheet1!book" '©R¦W§½³¡ÅܼơA§YSheet1¤W°Ï°ìD1¡GE6¬°book
©Î Names("computer").Name="robot" '±N°Ï°ìcomputer«©R¦W¬°robot
(60) Names("book").Delete '§R°£¦WºÙ
(61) Names.Add Name:="ContentList"¡A_
RefersTo:="=OFFSET(Sheet1!A2,0,0,COUNTA(Sheet2!$A:$A))" '°ÊºA©R¦WÄæ
(62) Names.Add Name:="Company",RefersTo:="CompanyCar" '©R¦W¦r²Å¦êCompanyCar
(63) Names.Add Name:="Total",RefersTo:=123456 '±N¼Æ¦r123456©R¦W¬°Total¡Cª`·N¼Æ¦r¤£¯à¥[¤Þ¸¹¡A§_«h´N¬O©R¦W¦r²Å¦ê¤F¡C
(64) Names.Add Name:="MyArray",RefersTo:=ArrayNum '±N°}¦CArrayNum©R¦W¬°MyArray¡C
(65) Names.Add Name:="ProduceNum",RefersTo:="=$B$1",Visible:=False '±N¦WºÙÁôÂÃ
(66) ActiveWorkbook.Names("Com").Name '¨ú±o¦WºÙ¦r²Å¦ê
¤¡G¤½¦¡»P¨ç¼Æ
(67) Application.WorksheetFunction.IsNumber("A1") '¨Ï¥Î¤u§@ªí¨ç¼ÆÀˬdA1Àx¦s®æ¤¤ªº¸ê®Æ¬O§_¬°¼Æ¦r
(68) Range("A:A").Find(Application.WorksheetFunction.Max(Range("A:A"))).Activate
¿ï¤¤Àx¦s®æ°Ï°ìAÄ椤³Ì¤jȪºÀx¦s®æ
(69) Cells(8,8).FormulaArray="=SUM(R2C[-1]:R[-1]C[-1]*R2C:R[-1]C)" '¦bÀx¦s®æ¤¤¿é¤J°}¦C¤½¦¡¡Cª`·N¥²¶·¨Ï¥ÎR1C1¼Ë¦¡ªºªí¹F¦¡
¹Ïªí
(70) ActiveSheet.ChartObjects.Count 'Àò¨ú·í«e¤u§@ªí¤¤¹ÏªíªºÓ¼Æ
(71) ActiveSheet.ChartObjects("Chart1").Select '¿ï¤¤·í«e¤u§@ªí¤¤¹ÏªíChart1
(72) ActiveSheet.ChartObjects("Chart1").Activate
ActiveChart.ChartArea.Select '¿ï¤¤·í«e¹Ïªí°Ï°ì
(73) WorkSheets("Sheet1").ChartObjects("Chart2").Chart. _
ChartArea.Interior.ColorIndex=2 '§ó§ï¤u§@ªí¤¤¹Ïªíªº¹Ïªí°ÏªºÃC¦â
(74) Sheets("Chart2").ChartArea.Interior.ColorIndex=2 '§ó§ï¹Ïªí¤u§@ªí¤¤¹Ïªí°ÏªºÃC¦â
(75) Charts.Add '²K¥[·sªº¹Ïªí¤u§@ªí
(76) ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:D5"), _
PlotBy:=xlColumns '«ü©w¹Ïªí¸ê®Æ·½¨Ã«öÄæ±ÆÄæ
(77) ActiveChart.Location Where:=xlLocationAsNewSheet '·s¹Ïªí§@¬°·s¹Ïªí¤u§@ªí
(78) ActiveChart.PlotArea.Interior.ColorIndex=xlNone '±Nø¹Ï°ÏÃC¦âÅܬ°¥Õ¦â
(79) WorkSheets("Sheet1").ChartObjects(1).Chart. _
Export FileName:="C¡GMyChart.gif",FilterName:="GIF" '±N¹Ïªí1¾É¥X¨ìCºÐ¤W¨Ã©R¦W¬°MyChart.gif
¤»¡Gµ¡Å骺¾Þ§@©R¥O
(80) MsgBox "Hello!" '«H®§®Ø¤¤Åã¥Ü«H®§Hello
(81) Ans=MsgBox("Continue?",vbYesNo) '¦b«H®§®Ø¤¤ÂIÀ»"¬O"«ö¶s¡A«hAnsȬ°vbYes¡FÂIÀ»"§_"«ö¶s¡A«hAnsȬ°vbNo¡C
If MsgBox("Continue?",vbYesNo)vbYes Then Exit Sub '¨ú±oȤ£¬°"¬O"¡A«h°h¥X
(82) Config=vbYesNo+vbQuestion+vbDefaultButton2 '¨Ï¥Î±`¶qªº²Õ¦X¡A½áȲÕConfigÅܼơA¨Ã³]¸m²Ä¤GÓ«ö¶s¬°¹w³]«ö¶s
(83) MsgBox "This is the first line." & vbNewLine & "Second line." '¦b«H®§®Ø¤¤±j¨î´«¦C¡A¥i¥ÎvbCrLf¥N´ÀvbNewLine¡C
(84) MsgBox "the average is :"&Format(Application.WorksheetFunction.Average(Selection),"#,##0.00"),vbInformation, "selection count average" & Chr(13) 'À³¥Î¤u§@ªí¨ç¼Æªð
¦^©Ò¿ï°Ï°ìªº¥§¡È¨Ã«ö«ü©w®æ¦¡Åã¥Ü
(85) Userform1.Show 'Åã¥Ü¥Î¤áµ¡Åé
(86) Load Userform1 '¥[¸ü¤@ӥΤᵡÅé,¦ý¸Óµ¡Åé³B©óÁôÂꬺA
(87) Userform1.Hide 'ÁôÂåΤᵡÅé
(88) Unload Userform1 ©Î Unload Me '¨ø¸ü¥Î¤áµ¡Åé
(89) (¹Ï¹³±±¥ó).Picture=LoadPicture("¹Ï¹³¸ô®|") '¦b¥Î¤áµ¡Å餤Åã¥Ü¹Ï§Î
(90) UserForm1.Show 0 ©Î UserForm1.Show vbModeless '±Nµ¡Åé³]¸m¬°¤£¿W¥e¼Ò¦¡ª¬ºA
(91) Me.Height=Int(0.88*ActiveWindow.Height) 'µ¡Åé°ª«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88
Me.Width=Int(0.88*ActiveWindow.Width) 'µ¡Åé¼e«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88
¨Æ¥ó
(92) Application.EnableEvents=False '¸T¥Î©Ò¦³¨Æ¥ó
Application.EnableEvents=True '±Ò¥Î©Ò¦³¨Æ¥ó
µù¡G¤£¾A¥Î©ó¥Î¤áµ¡Åé±±¥óIJµoªº¨Æ¥ó
¤C¡Gª«¥ó¾Þ§@
(93) Set ExcelSheet = CreateObject("Excel.Sheet") '³Ð«Ø¤@ÓExcel¤u§@ªíª«¥ó
ExcelSheet.Application.Visible = True '³]¸m Application ª«¥ó¨Ï Excel ¥i¨£
ExcelSheet.Application.Cells(1, 1).Value = "Data" '¦bªí®æªº²Ä¤@ӳ椸¤¤¿é¤J¤å¥»
ExcelSheet.SaveAs "C:\TEST.XLS" '±N¸Óªí®æ«O¦s¨ìC:\test.xls ¥Ø¿ý
ExcelSheet.Application.Quit 'Ãö³¬ Excel
Set ExcelSheet = Nothing 'ÄÀ©ñ¸Óª«¥óÅܼÆ
(94) 'Án©ú¨Ã³Ð«Ø¤@ÓExcelª«¥ó¤Þ¥Î
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.WorkSheet
Set xlApp = CreateObject("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" '¬°ª«¥óÅܼƲK¥[ÃöÁä¦r©M±ø¥Ø
¤K¡G¨ä¥L
(98) Application.OnKey "^I","macro" '³]¸mCtrl+IÁ䬰macroµ{§Çªº§Ö±¶Áä
(99) Application.CutCopyMode=False '°h¥X°Å¤Á/½Æ»s¼Ò¦¡
(100) Application.Volatile True 'µL½×¦ó®É¤u§@ªí¤¤¥ô·NÀx¦s®æ«·spºâ¡A³£·|±j¨îpºâ¸Ó¨ç¼Æ
Application.Volatile False '¥u¦³¦b¸Ó¨ç¼Æªº¤@өΦhӤ޼Ƶo¥Í§ïÅܮɡA¤~·|«·spºâ¸Ó¨ç¼Æ |
|
|
|
|
|
|
- ©«¤l
- 17
- ¥DÃD
- 1
- ºëµØ
- 1
- ¿n¤À
- 42
- ÂI¦W
- 0
- §@·~¨t²Î
- Win 7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-4-8
- ³Ì«áµn¿ý
- 2012-6-15
|
¦^´_ 4# chen_cook
¬O§r¡A¨Ì¤¤µØ¥ÁªG¾Ëªk³W©w¬O¤j³°¦a°Ï
ª½±µ"Âà(Ác)¶K"¹L¨Ó¡A
¥¦Ìªº»yªk¸ò§Ú̦³¤£¦P sheets("¤u§@ªí1") sheet1 ==>"¤u§@ªí1"
¦]¬°VBA¤¤§Ú¹J¨ì§xÃø¡A¦Aºô¤WSEARCHı±o¤£¿ù¶K¹L¨Óªº |
|
¯qÁ¨à
|
|
|
|
|
- ©«¤l
- 17
- ¥DÃD
- 1
- ºëµØ
- 1
- ¿n¤À
- 42
- ÂI¦W
- 0
- §@·~¨t²Î
- Win 7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-4-8
- ³Ì«áµn¿ý
- 2012-6-15
|
¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-4-14 14:51 ½s¿è
¤¡G¤½¦¡»P¨ç¼Æ
(67) Application.WorksheetFunction.IsNumber(¡uA1¡v) '¨Ï¥Î¤u§@ªí¨ç¼ÆÀˬdA1³æ¤¸®æ¤¤ªº¼Æ¾Ú¬O§_¬°¼Æ¦r
(68) Range(¡uA:A¡v).Find(Application.WorksheetFunction.Max(Range(¡uA:A¡v))).Activate
'¿E¬¡³æ¤¸®æ°Ï°ìA¦C¤¤³Ì¤jȪº³æ¤¸®æ
(69) Cells(8,8).FormulaArray=¡u=SUM(R2C[-1]:R[-1]C[-1]*R2C:R[-1]C)¡v ¡y¦b³æ¤¸®æ¤¤¿é¤J¼Æ²Õ¤½¦¡¡Cª`·N¥²¶·¨Ï¥ÎR1C1¼Ë¦¡ªºªí¹F¦¡
¹Ïªí
(70) ActiveSheet.ChartObjects.Count 'Àò¨ú·í«e¤u§@ªí¤¤¹ÏªíªºÓ¼Æ
(71) ActiveSheet.ChartObjects(¡uChart1¡v).Select ¡y¿ï¤¤·í«e¤u§@ªí¤¤¹ÏªíChart1
(72) ActiveSheet.ChartObjects(¡uChart1¡v).Activate
ActiveChart.ChartArea.Select ¡y¿ï¤¤·í«e¹Ïªí°Ï°ì
(73) WorkSheets(¡uSheet1¡v).ChartObjects(¡uChart2¡v).Chart. _
ChartArea.Interior.ColorIndex=2 ¡y§ó§ï¤u§@ªí¤¤¹Ïªíªº¹Ïªí°ÏªºÃC¦â
(74) Sheets(¡uChart2¡v).ChartArea.Interior.ColorIndex=2 ¡y§ó§ï¹Ïªí¤u§@ªí¤¤¹Ïªí°ÏªºÃC¦â
(75) Charts.Add ¡y²K¥[·sªº¹Ïªí¤u§@ªí
(76) ActiveChart.SetSourceData Source:=Sheets(¡uSheet1¡v).Range(¡uA1:D5¡v), _
PlotBy:=xlColumns ¡y«ü©w¹Ïªí¼Æ¾Ú·½¨Ã«ö¦C±Æ¦C
(77) ActiveChart.Location Where:=xlLocationAsNewSheet ¡y·s¹Ïªí§@¬°·s¹Ïªí¤u§@ªí
(78) ActiveChart.PlotArea.Interior.ColorIndex=xlNone ¡y±Nø¹Ï°ÏÃC¦âÅܬ°¥Õ¦â
(79) WorkSheets(¡uSheet1¡v).ChartObjects(1).Chart. _
Export FileName:=¡uC¡GMyChart.gif¡v,FilterName:=¡uGIF¡v ¡y±N¹Ïªí1¾É¥X¨ìC½L¤W¨Ã©R¦W¬°MyChart.gif
¤»¡Gµ¡Å骺¾Þ§@©R¥O
(80) MsgBox ¡uHello!¡v '®ø®§®Ø¤¤Åã¥Ü®ø®§Hello
(81) Ans=MsgBox(¡uContinue?¡v,vbYesNo) '¦b®ø®§®Ø¤¤ÂIÀ»¡u¬O¡v«ö¶s¡A«hAnsȬ°vbYes¡FÂIÀ»¡u§_¡v«ö¶s¡A«hAnsȬ°vbNo¡C
If MsgBox(¡uContinue?¡v,vbYesNo)vbYes Then Exit Sub 'ªð¦^Ȥ£¬°¡u¬O¡v¡A«h°h¥X
(82) Config=vbYesNo+vbQuestion+vbDefaultButton2 '¨Ï¥Î±`¶qªº²Õ¦X¡A½áȲÕConfigÅܶq¡A¨Ã³]¸m²Ä¤GÓ«ö¶s¬°¯Ê¬Ù«ö¶s
(83) MsgBox ¡uThis is the first line.¡v & vbNewLine & ¡uSecond line.¡v '¦b®ø®§®Ø¤¤±j¨î´«¦æ¡A¥i¥ÎvbCrLf¥N´ÀvbNewLine¡C
(84) MsgBox "the average is :"&Format(Application.WorksheetFunction.Average(Selection),"#,##0.00"),vbInformation, "selection count average" & Chr(13) 'À³¥Î¤u§@ªí¨ç¼Æªð
¦^©Ò¿ï°Ï°ìªº¥§¡È¨Ã«ö«ü©w®æ¦¡Åã¥Ü
(85) Userform1.Show ¡yÅã¥Ü¥Î¤áµ¡Åé
(86) Load Userform1 ¡y¥[¸ü¤@ӥΤᵡÅé,¦ý¸Óµ¡Åé³B©óÁôÂꬺA
(87) Userform1.Hide ¡yÁôÂåΤᵡÅé
(88) Unload Userform1 ©Î Unload Me ¡y¨ø¸ü¥Î¤áµ¡Åé
(89) (¹Ï¹³±±¥ó).Picture=LoadPicture(¡u¹Ï¹³¸ô®|¡v) ¡y¦b¥Î¤áµ¡Å餤Åã¥Ü¹Ï§Î
(90) UserForm1.Show 0 ©Î UserForm1.Show vbModeless ¡y±Nµ¡Åé³]¸m¬°µL¼Ò¦¡ª¬ºA
(91) Me.Height=Int(0.88*ActiveWindow.Height) ¡yµ¡Åé°ª«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88
Me.Width=Int(0.88*ActiveWindow.Width) ¡yµ¡Åé¼e«×¬°·í«e¬¡°Êµ¡¤f°ª«×ªº0.88
¨Æ¥ó
(92) Application.EnableEvents=False '¸T¥Î©Ò¦³¨Æ¥ó
Application.EnableEvents=True '±Ò¥Î©Ò¦³¨Æ¥ó
µù¡G¤£¾A¥Î©ó¥Î¤áµ¡Åé±±¥óIJµoªº¨Æ¥ó
¤C¡G¹ï¶H¾Þ§@
(93) Set ExcelSheet = CreateObject("Excel.Sheet") ¡y³Ð«Ø¤@ÓExcel¤u§@ªí¹ï¶H
ExcelSheet.Application.Visible = True '³]¸m Application ¹ï¶H¨Ï Excel ¥i¨£
ExcelSheet.Application.Cells(1, 1).Value = "Data" '¦bªí®æªº²Ä¤@ӳ椸¤¤¿é¤J¤å¥»
ExcelSheet.SaveAs "C:\TEST.XLS" '±N¸Óªí®æ«O¦s¨ìC:\test.xls ¥Ø¿ý
ExcelSheet.Application.Quit 'Ãö³¬ Excel
Set ExcelSheet = Nothing 'ÄÀ©ñ¸Ó¹ï¶HÅܶq
(94) ¡yÁn©ú¨Ã³Ð«Ø¤@ÓExcel¹ï¶H¤Þ¥Î
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.WorkSheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
(95) ¡y³Ð«Ø¨Ã¶Ç»¼¤@Ó Excel.Application ¹ï¶Hªº¤Þ¥Î
Call MySub (CreateObject("Excel.Application"))
(96) Set d = CreateObject(Scripting.Dictionary) ¡y³Ð«Ø¤@Ó Dictionary ¹ï¶HÅܶq
(97) d.Add "a", "Athens" '¬°¹ï¶HÅܶq²K¥[ÃöÁä¦r©M±ø¥Ø
¤K¡G¨ä¥L
(98) Application.OnKey ¡u^I¡v,¡vmacro¡v '³]¸mCtrl+IÁ䬰macro¹Lµ{ªº§Ö±¶Áä
(99) Application.CutCopyMode=False ¡y°h¥X°Å¤Á/½Æ»s¼Ò¦¡
(100) Application.Volatile True 'µL½×¦ó®É¤u§@ªí¤¤¥ô·N³æ¤¸®æ«·spºâ¡A³£·|±j¨îpºâ¸Ó¨ç¼Æ
Application.Volatile False '¥u¦³¦b¸Ó¨ç¼Æªº¤@өΦhӰѼƵo¥Í§ïÅܮɡA¤~·|«·spºâ¸Ó¨ç¼Æ |
|
¯qÁ¨à
|
|
|
|
|