Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSN STOCK QUOTES Add-Ins SPA Setting up and Configuration of Excel 0 April 20th 10 06:06 PM
Stock Quotes djungst Excel Discussion (Misc queries) 1 March 2nd 10 06:54 PM
Stock Quotes from Web [email protected] Excel Programming 1 May 4th 07 05:52 PM
Stock Quotes mman493 Excel Worksheet Functions 0 May 2nd 07 07:29 PM
How do i get historical stock quotes using MSN Money Stock Quotes Ash Excel Discussion (Misc queries) 0 May 11th 06 03:26 AM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"