Hi All,
I am trying to get the script to copy the chart and paste as picture using data from a list (offset List until empty cell).
The VBA below ran successfully but did not do the 1st FOR LOOP that I wanted it to.
I am trying to get the script to copy the chart and paste as picture using data from a list (offset List until empty cell).
The VBA below ran successfully but did not do the 1st FOR LOOP that I wanted it to.
Code:
[COLOR=#333333]Sub xxx()[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' Prevents Screen Refreshing[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = False[/COLOR]
[COLOR=#333333]Range("B6").Select[/COLOR]
[COLOR=#333333]Application.CutCopyMode = False[/COLOR]
[COLOR=#333333]ActiveCell.FormulaR1C1 = _[/COLOR]
[COLOR=#333333]"=IF(R2C2="""","""",SUMIFS(Sheet1!C[1],Sheet1!C1,R2C2,Sheet1!C2,RC1))"[/COLOR]
'Create 1st Loop by using the
Dim x As Integer
'Set Numrows = number of rows of data
numrows = Range("I2", Range("H:H").End(xlDown)).Rows.Count
' Select cell B2
Range("B2").Select
' Establish "For" loop to loop "numrows" number of times
For x = 1 To numrows
ActiveCell.FormulaR1C1 = "=RC[7]"
Dim arange As Range
Range("A5:F29").Select
Application.CutCopyMode = False
Selection.Copy
Range("A38").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set arange = Range("A38:F62")
For Each cell In arange
If cell.Text = "#N/A" Then
cell.ClearContents
End If
Next
ActiveSheet.ChartObjects("Chart 1").Activate
Application.CutCopyMode = False
ActiveChart.ChartArea.Copy
Range("K65").Select
ActiveSheet.PasteSpecial Format:="Picture (JPEG)", Link:=False, _
DisplayAsIcon:=False
Next
[COLOR=#333333]End Sub[/COLOR]