Domanda

run-time error '1004': "cells" method of object '_global' failed

numShips=7
ActiveChart.SetSourceData Source:=Sheets("Ship Tracker").Range(Cells(2,78),Cells(17, NumShips+80)),_
PlotBy:=xlColumns

Why did I get this error. Thanks.

È stato utile?

Soluzione

Try this one (you haven't specify sheet to which Cells() belongs):

NumShips = 7
With Sheets("Ship Tracker")
    ActiveChart.SetSourceData Source:=.Range(.Cells(2, 78), .Cells(17, NumShips + 80)), PlotBy:=xlColumns
End With
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top