Error 1004

T

tpeter

I am attempting to make a dynamic Histogram and chart. I have recorded the
macro but when I run it the macro breaks and gives me the above error saying
ATPVBAEN.XLA cant be found. I have tried it with the empty sheet there and
with no extra tab. Thank you for your help.

Tim Peter
 
P

Pete_UK

Have you installed the Analysis ToolPak? This is included within
XL2007, but on earlier versions you need to install it - check XL Help
on how to do this.

Hope this helps.

Pete
 
T

tpeter

I am running 2003. The toolpack is installed, I recorded a macro and then
tried to get it to run as a check and then I got the initial error. Here is
the code, it breaks as soon as it starts running:

Sub His()
'
' His Macro
' Macro recorded 11/11/2009 by tpeter
'

'
Application.Run "ATPVBAEN.XLA!Histogram", , "", , True, False, True, _
False
ActiveWindow.SmallScroll Down:=-6
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").ScaleWidth 1.91, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 1").ScaleHeight 3.3, msoFalse,
msoScaleFromTopLeft
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R2C1:R242C1"
ActiveChart.SeriesCollection(1).Values = "=Sheet3!R2C2:R242C2"
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 230
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 229
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 228
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 226
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 221
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 216
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 212
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 207
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 201
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 186
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 177
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 167
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 159
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 140
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 133
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 124
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 118
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 112
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 101
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 96
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 92
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 89
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 84
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 82
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 78
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 75
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 70
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 67
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 65
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 62
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 54
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 50
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 45
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 41
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 31
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 25
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 16
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 5
Windows("Compiled w-0 425-630 n 800-1000.xls").ScrollRow = 1
ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
ActiveChart.ChartArea.Select
ActiveChart.HasLegend = False
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLogarithmic
.DisplayUnit = xlNone
End With
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").ScaleWidth 1.33, msoFalse,
msoScaleFromTopLeft
End Sub

Thanks for all of your help.
 
D

Dave Peterson

When I did this manually, I got ranges passed to the line of code:

Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$C$16:$C$31"), _
ActiveSheet.Range("$M$16:$M$24"), ActiveSheet.Range("$D$16:$D$31"), True, _
False, False, False

The parms are in this order:

inprng
outrng
binrng
pareto
chartc
chart
labels

I don't know what sheet you're using or the ranges that you need, but maybe you
can plug your ranges (and other choices) into that line of code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top