View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bonobo Bonobo is offline
external usenet poster
 
Posts: 17
Default range with variable row

so would this syntax be correct?

With ActiveChart.SeriesCollection.NewSeries
..Values = ActiveSheet.Range("E" & r, "H" & r, "K" & r, "N" & r, "Q" & r)

It is giving me an error 450: Wrong number of arguments or invalid property
assignment

What am I doing wrong?

"Joel" wrote:

range doesn't have to be continous.

Range("A1,D5, E4:G8") = 5

The numbers can be replace by variable

MyRow = 4
Range("A1,D5, E" & Myrow & ":G8") = 5

"Bonobo" wrote:

thanks!

what if I want a range of cells that are not contiguous?
Let's say a range with cells in row r and columns D, F and H (r being a loop
from 14 to lastrow )

"Joel" wrote:



set myrange = Range("D" & r & ":P" & r)

"Bonobo" wrote:

I have a macro with a loop From r = 14 to lastrow
I need to define a Range with Row r and Columns "D" to "P"

What is the correct syntax to define the range with a variable row?