surfinsunshinekat
New Member
Hi everyone - I'm very new with VBA and am having a problem trying to debug a piece of code that is regularly used in my office and was previously written by someone else. I am new at this job and they've turned to me to fix this macro! I was able to fix a few previous problems within the macro (and felt very successful!) but now I am stuck! Please forgive me if I am not clear enough or do not use the right vocabulary. I am also unsure what constitutes a large or small file so hopefully this piece I will paste here isn't too big. I have also tried looking at many other threads and threads within other website but didn't find anything that could help me.
I attempt to run my code and I keep getting the "1004: Method of 'Range' of object '_Global' failed" error message. The Debug function will immediately go to the line "ActiveChart.SetSourceData Source:=Range("Charts!$E$1:$F$4")" I have tried several things to correct this error but I am without success. Does anyone have any ideas? Please let me know if you need to see all the code, in which case I will upload the file to a file sharing website.
Again, since I am very new with VBA, I apologize in advance if I haven't quite posted this piece of code correctly or if I am not using the correct terminology. Thank you!
I attempt to run my code and I keep getting the "1004: Method of 'Range' of object '_Global' failed" error message. The Debug function will immediately go to the line "ActiveChart.SetSourceData Source:=Range("Charts!$E$1:$F$4")" I have tried several things to correct this error but I am without success. Does anyone have any ideas? Please let me know if you need to see all the code, in which case I will upload the file to a file sharing website.
Again, since I am very new with VBA, I apologize in advance if I haven't quite posted this piece of code correctly or if I am not using the correct terminology. Thank you!
Code:
Select Case ChartComboBox.Value
Case "Yes"
Cells.Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("E1:F4").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Range("Charts!$E$1:$F$4")
ActiveChart.ApplyLayout (10)
ActiveChart.ChartTitle.Select
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 25
ActiveChart.ClearToMatchStyle
ActiveChart.ChartTitle.Text = "CHIHUAHUA SUSPENSION"
Selection.Format.TextFrame2.TextRange.Characters.Text = "CHIHUAHUA SUSPENSION"
With Selection.Format.TextFrame2.TextRange.Characters(1, 20).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Characters(1, 20).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 18
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With