Trouble testng for vale in one xls file, copying values and pasting into another xls worksheet

HJReed

New Member
Joined
May 25, 2013
Messages
27
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.
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I AM REPOSTING AS IT LOOKS LIKE THE ORIGINAL POST GOT SCRAMBLED....

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
ActiveWorkbook.Save

'
' 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
'
' paste into original worksheet
'
Windows("My Story Tracking Plan.xlsm").Activate
Range("T4").Select
ActiveSheet.Paste

Application.EnableEvents = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,203,758
Messages
6,057,184
Members
444,913
Latest member
ILGSE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top