I have a macro written that copies a picture of a certain range and copies it into a chart object. The code works perfectly, but when I increase the size of the range I get run time 1004 error 'Application-defined or object-defined error'. i.e...I change U40 below to U50.
Does anyone see an issue I'm missing, that might be causing this error?
Sub RangePicSales()
With Worksheets("Dashboard").Range("F8:U40")
.CopyPicture xlScreen, xlBitmap
With ActiveSheet.ChartObjects.Add(.Left, .Top + .Height + 1, .Width, .Height).Chart
.Paste
With .Shapes(1)
.Placement = xlMove
.Left = -4
.Top = -4
End With
.Export Filename:="RemovedFilePathForPost\WeeklySalesDashboard.png", Filtername:="PNG"
.Parent.Delete
End With
End With
End Sub