Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Utiliser le nom du nouveau graphique

1 réponse
Avatar
garnote
Bonsoir, Bonsoir,

Comment faire pour donner au graphique obtenu
par cette macro les dimensions et les positions voulues ?

Sub Nuage()
Application.ScreenUpdating = False
Set ici = Selection
haut = ici.Top
gauche = ici.Left + ici.Width
nom = ActiveSheet.Name
Charts.Add
n = ActiveChart.Name ' ***
With ActiveChart
.ApplyCustomType ChartType:=xlXYScatterSmoothNoMarkers
.SetSourceData Source:=ici
.Location Where:=xlLocationAsObject, Name:=nom
End With
'C'est ici que ça cloche. Je voudrais utiliser n ***
'With ActiveSheet.ChartObjects(1)
' .Top = haut
' .Left = gauche
' .Height = 204
' .Width = 300
'End With
ici(1, 1).Select
End Sub

Serge

1 réponse

Avatar
garnote
En passant par n = ActiveSheet.ChartObjects.Count
je crois que ça y est. Avec le nom du graphique, ???

Sub Nuage()
Application.ScreenUpdating = False
Set ici = Selection
haut = ici.Top
gauche = ici.Left + ici.Width
nom = ActiveSheet.Name
Charts.Add
With ActiveChart
.ApplyCustomType ChartType:=xlXYScatterSmoothNoMarkers
.SetSourceData Source:=ici
.Location Where:=xlLocationAsObject, Name:=nom
End With
n = ActiveSheet.ChartObjects.Count
With ActiveSheet.ChartObjects(n)
.Top = haut
.Left = gauche
.Height = 204
.Width = 300
End With
ici(1, 1).Select
End Sub

Serge


Bonsoir, Bonsoir,

Comment faire pour donner au graphique obtenu
par cette macro les dimensions et les positions voulues ?

Sub Nuage()
Application.ScreenUpdating = False
Set ici = Selection
haut = ici.Top
gauche = ici.Left + ici.Width
nom = ActiveSheet.Name
Charts.Add
n = ActiveChart.Name ' ***
With ActiveChart
.ApplyCustomType ChartType:=xlXYScatterSmoothNoMarkers
.SetSourceData Source:=ici
.Location Where:=xlLocationAsObject, Name:=nom
End With
'C'est ici que ça cloche. Je voudrais utiliser n ***
'With ActiveSheet.ChartObjects(1)
' .Top = haut
' .Left = gauche
' .Height = 204
' .Width = 300
'End With
ici(1, 1).Select
End Sub

Serge