ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stock quotes from web site (https://www.excelbanter.com/excel-programming/410114-stock-quotes-web-site.html)

Melwin

Stock quotes from web site
 
Hi,

I want to make a public function that takes a stock ticker as input and
searches a specified website for the latest price information. How shall I do
this?

Thank you for your help

--
Wiggo

ryguy7272

Stock quotes from web site
 
Put the stock symbol in cell A1, then run this macro:
Sub Macro2()


Rows("2:65536").Select
Selection.ClearContents
Range("A1").Select

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q?s=" & Range("A1"),
Destination:=Range("A2"))
.Name = "q?s=" & Range("A1")
.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 = """table1"",""table2"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

End Sub

See this site for information on running a macro:
http://www.anthony-vba.kefra.com/vba...ur_First_Macro

Finally, if you right click on that sheet tab, and paste this code into the
window that opens:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
ThisWorkbook.FollowHyperlink _
Address:="http://finance.yahoo.com/q/pr?s=" & _
Target.Text
Cancel = True
End Sub

You can double-click on the cell with the security symbol in it (remember it
is in A1) and a window will open with lots and lots of good information
pertaining to that particular security.

All you have to do now is decide how you will spend all the ridiculous
amounts of money that you are going to make...

Regards,
Ryan---

--
RyGuy


"Melwin" wrote:

Hi,

I want to make a public function that takes a stock ticker as input and
searches a specified website for the latest price information. How shall I do
this?

Thank you for your help

--
Wiggo



All times are GMT +1. The time now is 08:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com