![]() |
Moving chart window in macro
Does anyone out there know how to move the chart window
range in a macro? I'm backtesting stock data on an indicator I'm building, and I'd like to be able to inch forward a day at a time. I wrote a macro a couple of years ago that did this, but for the life of me, I can't get anything to work now. From what I remember, it was just a small snippet of code (maybe 5-6 lines) and i used the activecell and offset functions to change the range. If anyone knows how to do this, I'd be incredibly grateful, maybe even to the point of considering them a minor god. The ability to move both sides of the window (1-50, then 2-51, etc.) would be cool, but not necessary. Thanks, Rustar |
Moving chart window in macro
Rustar,
I am taking a shot in the dark here. I think your critical functions are offset and resize. In VBA, offset doesn't work the same as it does in the normal spreadsheet mode. You must use resize as you move along. Borrowing from XL Help: This example assumes that Sheet1 contains a table that has a header row. The example selects the table, without selecting the header row. The active cell must be somewhere in the table before the example is run. Set tbl = ActiveCell.CurrentRegion tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _ tbl.Columns.Count).SelectSo you could just increment your offset position?Hope this is of some value.Regards,Kevin "Rustar" wrote in message ... Does anyone out there know how to move the chart window range in a macro? I'm backtesting stock data on an indicator I'm building, and I'd like to be able to inch forward a day at a time. I wrote a macro a couple of years ago that did this, but for the life of me, I can't get anything to work now. From what I remember, it was just a small snippet of code (maybe 5-6 lines) and i used the activecell and offset functions to change the range. If anyone knows how to do this, I'd be incredibly grateful, maybe even to the point of considering them a minor god. The ability to move both sides of the window (1-50, then 2-51, etc.) would be cool, but not necessary. Thanks, Rustar |
Moving chart window in macro
Rustar -
I've written an article for TechTrax e-zine which shows how to do this in a worksheet without VBA, just using scroll bars and dynamic range names. It will be published on the web in a week or so. Here's the link to the current issue, from which you'll be able to find the new one when it comes out. - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Rustar wrote: Does anyone out there know how to move the chart window range in a macro? I'm backtesting stock data on an indicator I'm building, and I'd like to be able to inch forward a day at a time. I wrote a macro a couple of years ago that did this, but for the life of me, I can't get anything to work now. From what I remember, it was just a small snippet of code (maybe 5-6 lines) and i used the activecell and offset functions to change the range. If anyone knows how to do this, I'd be incredibly grateful, maybe even to the point of considering them a minor god. The ability to move both sides of the window (1-50, then 2-51, etc.) would be cool, but not necessary. Thanks, Rustar |
Moving chart window in macro
It looks like Jon forgot to include the link. Here's the October issue:
http://pubs.logicalexpressions.com/P...ssue.asp?ISI=0 and a link to Jon's Charting FAQ article from September: http://pubs.logicalexpressions.com/P...cle.asp?ID=209 Jon Peltier wrote: Rustar - I've written an article for TechTrax e-zine which shows how to do this in a worksheet without VBA, just using scroll bars and dynamic range names. It will be published on the web in a week or so. Here's the link to the current issue, from which you'll be able to find the new one when it comes out. - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Rustar wrote: Does anyone out there know how to move the chart window range in a macro? I'm backtesting stock data on an indicator I'm building, and I'd like to be able to inch forward a day at a time. I wrote a macro a couple of years ago that did this, but for the life of me, I can't get anything to work now. From what I remember, it was just a small snippet of code (maybe 5-6 lines) and i used the activecell and offset functions to change the range. If anyone knows how to do this, I'd be incredibly grateful, maybe even to the point of considering them a minor god. The ability to move both sides of the window (1-50, then 2-51, etc.) would be cool, but not necessary. Thanks, Rustar -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 12:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com