initialize
New Member
- Joined
- Dec 7, 2015
- Messages
- 29
Code:
Sub smarterway()
Dim chartfirst As ChartObject
Dim rngChart As Range
Set rngChart = Range("D3:J20")
Set chartfirst = ActiveSheet.ChartObjects.Add(Left:=rngChart.Left, Top:=rngChart.Top, Width:=rngChart.Width, Height:=rngChart.Height)
[....]
For this line:
> Set chartfirst = ActiveSheet.ChartObjects.Add(..)
if I dont add in *Activesheet* in. I would get a *Object Required* error.
I don't understand why though. Isnt it assumed that it is Activesheet, cause I usually don't put Activesheet in my codes and it works as long as I have the required sheet opened and activated.
I'm clearly missing and misunderstanding something very fundamental in vba, please advice