ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grouping Rows (https://www.excelbanter.com/excel-programming/439947-grouping-rows.html)

Ayo

Grouping Rows
 
I need to group a bunch of rows but I am having some problems. The code
lines below works great:
Rows("5:8").Select
Selection.Rows.Group
but I need to group these rows 12,14,16,18,20,22,24,26,28,30. I tried
Rows("12,14,16,18,20,22,24,26,28,30").Select
Selection.Rows.Group
but I get and Overflow error message. When I tried
Me.Rows("12:12,14:14,16:16,18:18,20:20,22:22,24:24 ,26:26,28:28,30:30").Select
Selection.Rows.Group
I get a Type mismatch error message.

What am I doing wrong?

Per Jessen

Grouping Rows
 
HI

The 'Rows' object obviously do not accept non-coherent rows, but the Range
object does, so the code below will work:

Range("A12,A14,A16,A18,A20,A22,A24,A26,A28,A30").E ntireRow.Select

Regards,
Per

"Ayo" skrev i meddelelsen
...
I need to group a bunch of rows but I am having some problems. The code
lines below works great:
Rows("5:8").Select
Selection.Rows.Group
but I need to group these rows 12,14,16,18,20,22,24,26,28,30. I tried
Rows("12,14,16,18,20,22,24,26,28,30").Select
Selection.Rows.Group
but I get and Overflow error message. When I tried
Me.Rows("12:12,14:14,16:16,18:18,20:20,22:22,24:24 ,26:26,28:28,30:30").Select
Selection.Rows.Group
I get a Type mismatch error message.

What am I doing wrong?




All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com