Hi Forum contributors
Is it possible to automate the copying of selected fields from a web page to my Excel sheet?
The fields that need copying are the Earning Announcement date (in Company events) and Analyst Opinion Recommondation Trends (in Analyst Opinion).
Currently I use this macro:
Sub Earnings()
Dim x As Integer, y As Integer
'--------------------------------------------------------------------------
Range("A1").Activate
Cells.Find(What:="Row Number", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
x = ActiveCell.Offset(0, 1) 'Total Rows
y = ActiveCell.Offset(0, 2) 'Highlighted Rows
'--------------------------------------------------------------------------
Range("A2").Select 'Link to yahoo financial page for this stock
For I = 1 To y
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Stop 'Manually copy Company Events Earnings Announcement Date
ActiveCell.Offset(0, 2).Select
ActiveSheet.Paste
'-------------------------------
ActiveCell.Offset(0, 1).Select
Stop 'Manually copy Analyst Opinion Recommendation Trends
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Select
Next I
End Sub
Bookmarks