JohnZ1156
Board Regular
- Joined
- Apr 10, 2021
- Messages
- 157
- Office Version
- 2021
- Platform
- Windows
I have a chart on my worksheet that I want to move to a location based on a variable.
I want to move the chart to column N at the row number in variable r.
So, kinda, cell Nr?
I want to move the chart to column N at the row number in variable r.
So, kinda, cell Nr?
VBA Code:
Sub MoveChart()
Dim r As Integer
Range("A1048576").End(xlUp).Select
ActiveCell.Offset(-25, 0).Select
Application.Goto ActiveCell, Scroll:=True
r = ActiveCell.Row
With ActiveSheet
.ChartObjects(1).Top = .Range("n8129").Top
.ChartObjects(1).Left = .Range("n8129").Left
End With
ActiveCell.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
End Sub