Do you know how to make a loop in VBA to insert a chart for for example every range containing string "%" or just for every separate range as shown on picture? I tried using such code as shown on the picture but it only adds chart for the first range, not for all of them.
I tried such code:
Sub Charts()
Const SFind As String = "%"
Dim rng As Range
Dim lo As ListObjects
For Each lo In Worksheets("Wyniki").ListObjects
On Error Resume Next
Set rng = ActiveSheet.Cells.Find(SFind).CurrentRegion
If Not rng Is Nothing Then
With ActiveSheet.Shapes.AddChart.Chart
.ChartType = xlColumnClustered
.SetSourceData rng
End With
End If
Next
End Sub