I'm trying to set a range in a chart series collection from a public variable. The data range is stored in another sheet in the following format. Here is code I have also hard coded in my VBA sub to verify that the range is populating into the variable correctly and then converting to a range. I get the same error either way.
Public dataRange As String
dataRange = "MyData!$F$2:$F$118,$H$2:$H$118"
Dim rgnY As Range
Set rngY = Range(dataRange)
But I get this error:
Run-time error '1004' : Method 'Range' of object'_Global' failed
I'm not sure why this is happening. I've googled this error and although I see lots of suggestions I'm not sure how to fix in my case. I need to populate a chart series values and XValues with data stored in this format.
Any ideas on what I'm doing wrong and how to fix it?