[英]Specific Range in VBA Excel
I have created a pivot table in excel with vba. 我已经用vba在excel中创建了数据透视表。 Now I have to group some different rows.
现在,我必须对一些不同的行进行分组。 For Example A1, A6, A19 ...
例如A1,A6,A19 ...
The information which rows should be grouped are on an own Worksheet where I read from. 应该将哪些行分组的信息位于我从中读取的自己的工作表上。 When I create an new string which contains for example: groupString = "A1, A5, A90, A103" and then I use
Worksheets("TableTest").Range(groupString).Group
I always get an Runtime Error that I cannot group multiple selections. 当我创建一个包含例如:groupString =“ A1,A5,A90,A103”的新字符串,然后使用
Worksheets("TableTest").Range(groupString).Group
时,我总是会遇到一个运行时错误,我无法将多个错误分组选择。
When I use Worksheets("TableTest").Range("A1, A23").Group
it works, but I need the groups which I read from the other Worksheet. 当我使用
Worksheets("TableTest").Range("A1, A23").Group
它可以工作,但是我需要从其他Worksheet中读取的组。 Thanks for helping. 感谢您的帮助。
Kind regards 亲切的问候
Maybe when you use Worksheets("TableTest").Range("A1, A23").Group
, A23 falls out of pivot and only A1 is considered. 也许当您使用
Worksheets("TableTest").Range("A1, A23").Group
,A23脱离支点并且仅考虑A1。
Range.Group documentation states that range must specify a single cell. Range.Group文档指出,范围必须指定一个单元格。
Have you tried grouping cell by cell? 您是否尝试过按单元分组?
For Each cell in Worksheets("TableTest").Range(groupString).Cells
cell.Group
Next
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.