Search code examples
excelescapingdouble-quotesvba

escape double quotes visual basic excel


I am trying to escape double quotes in visual basic. I tried by adding double qutoes but nothing happens. Here is my script:

Sub Makro1() '

' Makro1 Makro
'

'
For i = 1 To 28
    ActiveSheet.ChartObjects("Diagramm i").Activate
    ActiveChart.SeriesCollection(2).Select
    Selection.MarkerSize = 4
    Selection.MarkerSize = 3
    ActiveChart.SeriesCollection(4).Select
    Selection.MarkerSize = 4
    Selection.MarkerSize = 3
    ActiveChart.SeriesCollection(7).Select
    Selection.MarkerSize = 4
    Selection.MarkerSize = 3
Next i
End Sub

I tried with ("""Diagramm i""") and with ("Diagramm ""i""") but it is not working. What do am I making false?Any ideas?


Solution

  • I believe what you are looking for is to concatenate the variable to Diagramm.

    I assume that Diagramm is not a variable, but actually the name of the chart, so you need:

    ActiveSheet.ChartObjects("Diagramm " & i).Activate