View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student
 
Posts: n/a
Default convert a string to range?

Sub ordinate()
Dim krange As String, r As Range
krange = "A1:A1, K1:P1, A5:A5,K5: P5 , A10: A10 , K10: P10 "
Set r = Range(krange)
End Sub

will definitely convert the string into a range. I know nothing about
charting, however.
--
Gary's Student


"JK" wrote:

Hi folks,

Not a programmer, try to write a macro to refresh a chart base on the
range I choose, say, in the previouse step, set "A1:A1, K1:P1, A5:A5,
K5:P5, A10:A10, K10:P10" to string variable wkrange.
then:

ActiveChart.SetSourceData Source:=Sheets("sheet1").range(wkrange) _
, PlotBy:=xlRows

I get run-time error '1004'

I know something wrong with range(wkrange), would you please shed some
light here?


Jack