View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Problem with VBA code and Range

"Jeffrey Marks" wrote:
I'm getting a 1004 - Range of Object _Global Failed
on the indicated statement.

[....]
chtNew.SetSourceData Source:=Range( _

"'OAT Test Charts Data_Crosstab'!$F$1:$K$1,
Range(ActiveCell,ActiveCell.Offset(0,6)).Select" _
) <<<


Syntactically, it should be:

chtNew.SetSourceData Source:=Range( _
"'OAT Test Charts Data_Crosstab'!$F$1:$K$1",
Range(ActiveCell,ActiveCell.Offset(0,6)).Select)

Note the change in where the right double-quote is.

PS: I would also eliminate .Select in the second Range parameter. I don't
know if it hurts to have it, but it is not likely that it is helpful, much
less necessary.