The code below opens a file on the web.
It is supposed to test if the header of that file is on row 9, 10 or 11 (it seems to change)
Based upon which row the header is (indicated by the word Symbol in col A - row 9/10/11) copy 51 rows of data
Activate back to the original sheet it was called from (My Story Tracking Plan.xlsm)and paste the data into that worksheet beginning in cell T4.
It won't flip back and do the paste.
I don't see why as I .Activate the original/calling worksheet but it won't paste so either the copy logic isn't working correctly, or I'm doing something else wrong.
Here's the code:
Sub T1_IBD_50_build_export_screen_file()
Application.EnableEvents = False
'
' select file located on web
'
Workbooks.Open Filename:= _
"http://news.investors.com/StockResearch/ScreenCenter/ExportScreen.aspx?start=ibd"
ActiveWindow.Visible = True
' test to see which line the first row of data is in (seems to shift between row 9, 10 and 11)
' copy current data
Range("A9").Select
If Cells.Select = "Symbol" Then
Range("A10:X61").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Range("A10").Select
If Cells.Select = "Symbol" Then
Range("A11:X62").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Range("A11").Select
If Cells.Select = "Symbol" Then
Range("A12:X63").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Application.EnableEvents = True
End Sub
Appreciate any corrections, comments or suggestions
Thanks in advance for looking at this.
It is supposed to test if the header of that file is on row 9, 10 or 11 (it seems to change)
Based upon which row the header is (indicated by the word Symbol in col A - row 9/10/11) copy 51 rows of data
Activate back to the original sheet it was called from (My Story Tracking Plan.xlsm)and paste the data into that worksheet beginning in cell T4.
It won't flip back and do the paste.
I don't see why as I .Activate the original/calling worksheet but it won't paste so either the copy logic isn't working correctly, or I'm doing something else wrong.
Here's the code:
Sub T1_IBD_50_build_export_screen_file()
Application.EnableEvents = False
'
' select file located on web
'
Workbooks.Open Filename:= _
"http://news.investors.com/StockResearch/ScreenCenter/ExportScreen.aspx?start=ibd"
ActiveWindow.Visible = True
' test to see which line the first row of data is in (seems to shift between row 9, 10 and 11)
' copy current data
Range("A9").Select
If Cells.Select = "Symbol" Then
Range("A10:X61").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Range("A10").Select
If Cells.Select = "Symbol" Then
Range("A11:X62").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Range("A11").Select
If Cells.Select = "Symbol" Then
Range("A12:X63").Select
Selection.Copy
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste
End If
Application.EnableEvents = True
End Sub
Appreciate any corrections, comments or suggestions
Thanks in advance for looking at this.
Last edited: