简体   繁体   English

使用定义的范围更新图表以包含最后一行数据

[英]Update Chart to include last row data using defined range

I have a question , similar to this VBA: Modify chart data range But I the answer was based on horizontal data set.我有一个问题,类似于这个VBA:修改图表数据范围但我的答案是基于水平数据集。

How can I make this named range update to include latest row on a vertical column set ?如何使此命名范围更新以包含垂直列集上的最新行?

This is what I got as my formula, B1 being the header, and Column B will have all my data.这就是我的公式,B1 是标题,B 列将包含我的所有数据。

=OFFSET(Sheet1!$B$1,,,1,COUNTA(Sheet1!$B2:$B))

Edit编辑

I am using the following defined range now:我现在使用以下定义的范围:

=OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B2:$B1000),1)

but when I add it to my chart I get the following error:但是当我将它添加到我的图表时,我收到以下错误:

在此处输入图片说明

You're almost there - you basically need to swap height parameter with width: =OFFSET(Sheet1!$B$1,,,COUNTA(Sheet1!$B1:$B1000),1)你快到了 - 你基本上需要用宽度交换高度参数:=OFFSET(Sheet1!$B$1,,,COUNTA(Sheet1!$B1:$B1000),1)

Here's a range that excludes header in B1: =OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B2:$B1000),1)这是一个不包括 B1 中的标题的范围:=OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B2:$B1000),1)

Of course you're welcome to extend the B1:B1000 range.当然,欢迎您扩展 B1:B1000 范围。 Hope it helps!希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM