Grabación de macro genera error

Caliche

Active Member
Joined
Mar 26, 2002
Messages
339
Estaba tratando de grabar una macro (Herramientas, Macro, Crear nueva macro) para dale formato a la Tabla de Datos de una gráfica. El código generado fé el siguiente:

ActiveSheet.ChartObjects("Gráfico 3").Activate
"Tabla de datos".Comment.Shape.Select ' ACA HAY ERROR
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial Narrow"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With

El egenrador de código graba una instrucción con error (la que aparece en negrilla.

Cual podrá ser la causa de dicho error?

Cuales son las instrucciones VBA necesarias para darle formato (fuente, estilo, tamaño) a la Tabla de datos?

Muchas gracias por su ayuda.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Caliche,

No sé porque será que Excel le dio esta código erróneo, pero lo de abajo sí me funcionó. Creo que solo falta cambiar el índice de «1» a «"Gráfico 3"».
Code:
With ActiveSheet.ChartObjects(1).Chart.DataTable.Font
        .Name = "Arial Narrow"
        .FontStyle = "Normal"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With
Espero que le ayude.
Saludos,
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,571
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top