dabears19850
New Member
- Joined
- Dec 7, 2015
- Messages
- 4
So here's the situation... I've set up web queries for historical data from Yahoo Finance (so that way I can run automate updates on the data set). There's two web queries to upload two sets of data - 1 for the historical prices of an index, and the other for the historical prices of the ETF following that index. The data loads great and is aligned well EXCEPT for a small detail of the ETF data. The ETF data, in addition to loading the same exact date range as the Index, also downloads the dividend payout (while the index doesn't include that), so the dates no longer match going across the row (see image below).
For the tests I'm trying to run, it's imperative that the dates for the ETF and Index data match by dates, which they will if I can remove that dividend line. Which leads me to what I'm looking for - a Macro capable of deleting/excluding only the cells containing the dividend payouts of the ETF that would then shift up the cells below it. I had some success last night. I got a Macro which will eliminate the dividend payout row I don't want, and shifts up all the data below it. However, I need to click it every time I want to remove that dividend payout row (and every time I refresh the web queries the dividend payout row reappears). For my case where I have LOT of data on multiple sheets and with frequent refreshes of the web queries it's not feasible to click the Macro function every time. Here's the Macro I currently have below:
How can I make this a one-click Macro (or even an automatic Macro) any time I need to refresh the data set?
I uploaded the spreadsheet to Google Drive should anyone like to download the current file.

For the tests I'm trying to run, it's imperative that the dates for the ETF and Index data match by dates, which they will if I can remove that dividend line. Which leads me to what I'm looking for - a Macro capable of deleting/excluding only the cells containing the dividend payouts of the ETF that would then shift up the cells below it. I had some success last night. I got a Macro which will eliminate the dividend payout row I don't want, and shifts up all the data below it. However, I need to click it every time I want to remove that dividend payout row (and every time I refresh the web queries the dividend payout row reappears). For my case where I have LOT of data on multiple sheets and with frequent refreshes of the web queries it's not feasible to click the Macro function every time. Here's the Macro I currently have below:
Code:
<code>Sub Macro1()
'
' Macro1 Macro
'
'
Cells.Find(What:="dividend", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(ActiveCell.Offset(0, -1), ActiveCell.Offset(0, 5)).Select
Selection.Delete Shift:=xlUp
End Sub</code>
How can I make this a one-click Macro (or even an automatic Macro) any time I need to refresh the data set?
I uploaded the spreadsheet to Google Drive should anyone like to download the current file.