½Ð±Ð¦U¦ì¤j¤j:
¦³ÓVBAµ{¦¡¸ê®Æ§ì¤£¤U¨Ó
½Ð¦U¦ì¤j¤jÀ°¦£¬d¬Ýþ¸Ì¦³°ÝÃD
ÁÂÁÂ
Private Sub CommandButton1_Click()
Dim po As Integer '«Å§iPO¬°¾ã¼Æ
lR = Range("A2").End(xlDown).Row
Rows(lR + 1 & ":400").Select 'aÄæªÅ¥Õ¥H¤U¥þ§R°£
Selection.Delete shift:=xlUp
LRA = Range("C2").End(xlDown).Row
For i = 3 To LRA
If Cells(i, 5) <> "" Then
ValueSno = "$A$" & i
Linkss = "URL;https://tw.stock.yahoo.com/q/q?s=" & Cells(i, 1)
po = lR - 5 + (7 * (i - 2)) '©w§ì¨ú¸ê®Æªí®æ°j°é
With ActiveSheet.QueryTables.Add(Connection:= _
Linkss, Destination:=Sheets("¤u§@ªí1").Range("b" & po))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "6"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Name = .ResultRange.Cells(3, 1)
End With
Range("A" & po + 2) = Cells(i, 1)
Cells(i, 2) = "=vlookup(" & Cells(i, 1) & ",$A$16:$0$200,2,0)"
Cells(i, 2) = Mid(Cells(i, 2), 5)
Cells(i, 7) = "=vlookup(" & Cells(i, 1) & ",$A$16:$0$200,4,0)"
End If
Next
End Sub |