Probelm with Code !!!!!!!!!!!!!!!!!

A

Ayo

"The specified dimension is not valid for the current chart type" error. I
can't get rid of this eror even with 2 "On Error" Statements at the bottome
of the code where I suspect the problem to be.

Private Sub cmdgetBO_Data_Click()
Dim f, ws As Worksheet, Msg
Dim BO_Datafile_Name As String, BOReport_lastColumn As String
Dim BOReport_lastRow As Integer, BOPos As Integer
Dim BOReportWS As Worksheet
Dim rngBOReport As Range, c As Range

With Application
.ScreenUpdating = True
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
'" THIS SECTION OF CODE RETRIVES THE BO FILES FROM THE HARD DRIVE "'
f = Application.GetOpenFilename("Excel Files (*.xls),*.xls")

'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
'"" THIS SECTION OF CODE OPENS THE BO FILES FROM THE HARD DRIVE ""'
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
If f <> "" Then
Workbooks.Open filename:=f, UpdateLinks:=0, ReadOnly:=True
BO_Datafile_Name = ActiveWorkbook.Name
Else
Unload Me
Worksheets("BO Download").Visible = True
Range("A4").Select
Exit Sub
End If

'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
'"" THIS SECTION OF CODE COPIES THE BO SHEET FROM THE BO FILE ""'
'"" AND PASTE IT INTO THE SUMMARY REPORT FILE ""'
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'
Workbooks(BO_Datafile_Name).Sheets(1).Select
Workbooks(BO_Datafile_Name).Sheets(1).Copy
Before:=ThisWorkbook.ActiveSheet

'"" CLOSE THE BO DOWNLOAD DATA FILE ""'
Workbooks(BO_Datafile_Name).Activate
Workbooks(BO_Datafile_Name).Close

Set BOReportWS = ThisWorkbook.Worksheets("Report 1")
BOReportWS.Activate
BOReport_lastRow = ActiveSheet.UsedRange.Rows.Count

BOReportWS.Range("B5:AX" & BOReport_lastRow).Copy
ThisWorkbook.Worksheets("BO Download").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False
BOReportWS.Select
BOReportWS.Delete
Application.Calculate

With Worksheets("Completions Summary").Cells
.Copy
.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End With
Range("A4").Select

Worksheets("BO Download").Select
Worksheets("BO Download").Delete
Worksheets("Completions Summary").Select
Range("B4").Select
On Error GoTo 0
On Error Resume Next
Dim filename As String
filename = Mid(ActiveWorkbook.Name, 1, Len(ActiveWorkbook.Name) - 4)
ActiveWorkbook.SaveAs filename & "_" & Format(Date, "mmmdd_yy") & ".xls"
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
End Sub
 
B

broro183

hi Ayo,

There isn't much in your code that could relate to this "chart
dimensioning" error. Is the "Workbooks(BO_Datafile_Name).Sheets(1)"
sheet a chart?
Do you have other Charts in your workbook?
This is a longshot, but if you do have other charts, were any of them
copied from an Excel 2007 file?

You can replace your suspicion with facts by typing "Stop" by itself on
the line following "Private Sub...". Then when the macro is run, it will
Stop on this line & you can step through the code, line by line by
pressing the [F8] key. Press the [F8] key slowly to keep track of which
line is being run when the error occurs. Once you find this out, can you
please let us know?

hth
Rob
 

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