MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Select last n cells of a column

  Asked By: Darcy    Date: Jan 14    Category: MS Office    Views: 790

Is there a way one can assign the last n cells of a column as the
source data for a graph?

Right now I am selecting the last 30 cells of column B and storing
them in column A (A2:A31) and assigning it to the graph using the
below given code:

.SetSourceData Source:=Sheets("Sheet1").Range("A2:A31"),

I would like to avoid the loop that I use to copy 30 cells in column B
to Column A.



2 Answers Found

Answer #1    Answered By: Riley-jack Johnson     Answered On: Jan 14

.SetSourceData Source:=Range(Sheets("Sheet1").Range("B7").End(xlDown),
Sheets("Sheet1").Range("B7").End(xlDown).Offset(-29, 0))

I have used B7 as a starting point.
If there are gaps in the data  (blank cells) it will fail.

Answer #2    Answered By: Kawthar Malik     Answered On: Jan 14

I will make the necessary changes to suit my

Didn't find what you were looking for? Find more on Select last n cells of a column Or get search suggestion and latest updates.