- ©«¤l
- 8
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 56
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 7
- ³nÅ骩¥»
- office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-9-14
- ³Ì«áµn¿ý
- 2016-1-8
|
VBA§ì¨úºô¯¸¸ê®Æ
¦U¦ì¤j®a¦n¡A§Ú³Ìªñ¦b½m²ßVBA
§Ú·Qn¦b«ö¤U Button ¥i¥H¦³¥H¤Uµ{¦¡ªº¥\¯à
µ{¦¡¥\¯à¬OOKªº¡A¦ý¬O§ì¨ú®É¶¡«Ü¤[¦³®ÉÁÙ·|µL¦^À³
ÁÙ¦³¦AÅܧó§ì¨ú¤§¶g´Á®É¡A·|¦³§ì¨ì¶g´Áªº¸ê®Æªº°ÝÃD(¦ý¦h«ö´X¦¸·|´N·|¥¿±`)
·Q°Ý°Ý§Ún±qþÃäµÛ¤âÀu¤Æµ{¦¡
- Private Sub CommandButton2_Click()
- Range("A9:J168").Select
- ActiveWindow.SmallScroll Down:=-174
- Selection.ClearContents
- Selection.Clear
- Range("A8").Select
- '²M°£Â¸ê®Æ'
-
- With ActiveSheet.QueryTables.Add(Connection:= _
- "URL;http://www.cnyes.com/twstock/ps_historyprice.aspx?code=" & Cells(1, 3) & "&ctl00$ContentPlaceHolder1$startText=" & Cells(2, 3) & "&ctl00$ContentPlaceHolder1$endText=" & Cells(3, 3) _
- , Destination:=Range("$A$10"))
- .Name = "16_24"
- .FieldNames = True
- .RowNumbers = False
- .FillAdjacentFormulas = False
- .PreserveFormatting = False
- .RefreshOnFileOpen = False
- .BackgroundQuery = False
- .RefreshStyle = xlOverwriteCells
- .SavePassword = False
- .SaveData = True
- .AdjustColumnWidth = False
- .RefreshPeriod = 0
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "2"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- '§ì¨ú¹d¦ëºô¸ê®Æ'
- Range("A10:J50").Select
- ActiveWindow.SmallScroll Down:=-51
- Selection.AutoFilter
- ActiveWorkbook.Worksheets("¤u§@ªí2").AutoFilter.Sort.SortFields.Clear
- ActiveWorkbook.Worksheets("¤u§@ªí2").AutoFilter.Sort.SortFields.Add Key:=Range( _
- "A10:A31"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
- xlSortNormal
- With ActiveWorkbook.Worksheets("¤u§@ªí2").AutoFilter.Sort
- .Header = xlYes
- .MatchCase = False
- .Orientation = xlTopToBottom
- .SortMethod = xlPinYin
- .Apply
- End With
- '±Æ§Ç'
- Selection.AutoFilter
- ActiveWindow.SmallScroll Down:=-3
- Selection.ColumnWidth = 12
- Range("A8").Select
- 'ÅܧóÄæ¼e'
- End Sub
½Æ»s¥N½X |
|