Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
autoscale stock chart
Hi All,
xl2003. A candle stick stock chart with some moving averages is located as a new sheet. Trying to autoscale it using the next macro: Dim intMax1 As Integer Dim intMin1 As Integer Dim intMax2 As Integer Dim intMin2 As Integer Dim rngMin As Range Dim rngMax As Range Set rngMin = Worksheets("Stock Data").Range("c2:d94") Set rngMax = Worksheets("Stock Data").Range("c2:d94") intMin1 = Application.WorksheetFunction.Min(rngMin) intMin2 = Application.WorksheetFunction.RoundDown(intMin1, 0.1) intMax1 = Application.WorksheetFunction.Max(rngMax) intMax2 = Application.WorksheetFunction.RoundUp(intMax1,- 0.1) ActiveChart.Axes(xlValue, xlSecondary).Select With ActiveChart.Axes(xlValue, xlSecondary) .MinimumScale = intMin2 .MaximumScale = intMax2 End With The macro seems to work when the price of the stock is greater than $20. But when the stock price is less than $5 the autoscaling macro doesnt work properly. Tried to add these lines to the above macro: ActiveChart.Axes(xlValue, xlPrimary).Select With ActiveChart.Axes(xlValue, xlPrimary) .MinimumScale = intMin2 .MaximumScale = intMax2 End With but received €œRun-time error €˜1004 €œ message. Also changed : intMin2 = Application.WorksheetFunction.RoundDown(intMin1, +0.1) intMax2 = Application.WorksheetFunction.RoundUp(intMax1, -0.1) to intMin2 = Application.WorksheetFunction.RoundDown(intMin1, +0.01) intMax2 = Application.WorksheetFunction.RoundUp(intMax1, -0.01) and there wasnt any difference in the resulting chart. I know how to autoscale the chart when it is located as object in the Data sheet but this one (when the chart is located as a new sheet) drives me up to the wall. Any help is Highly appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
autoscale stock chart
Problem solved. Ignore my previous post.
Tim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can a stock chart be combined with an line chart? | Charts and Charting in Excel | |||
Combination of stock chart and line chart | Charts and Charting in Excel | |||
Super 2-axis chart Autoscale Macro ;-) | Excel Programming | |||
Autoscale a Line Chart to stack the curves | Charts and Charting in Excel | |||
Define Autoscale parameters in Chart | New Users to Excel |