excel - Change the grouping level of a newly inserted row (Excel)
问题描述
So, I have 3 levels of groupings in my excel sheet, and I am trying to add a row at the bottom of the sheet. I want the new row to extend the level 2 (and level 1) groupings but not the level 3, but I don't know how to do that. I would really appreciate it if any of you could help me.
Link to image for clarification -> https://imgur.com/8ucVHWQ Note: The new row is added above 16th row. 2nd image -> https://imgur.com/a/3w3huh0
Thank you in advance.
解决方案
试试这个子:
Public Sub InsertRowLevel2()
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.OutlineLevel = 3
End Sub
它将插入一个新行并将其设为 2 级。
但是,这是一个非常具体的功能,设计整个算法会是一个更好的主意,例如,您不应该依赖 ActiveCell,除非这将从命令按钮的事件处理程序中调用(并且您检查 ActiveCell 是一个您期望的,而不是在不同的工作簿中)。
推荐阅读
- php - 使用 PHP 处理 Webhook
- matplotlib - 使用 matplotlib 的 Wordcloud 未显示
- javascript - 无法使用 onfocus 事件在 javascript 中隐藏元素
- android - 我对 pdftron 集成有疑问
- apache-flink - 滑动时间窗口的 Flink 侧输出
- angular - Spring Boot 与 Spring Security 与 Angular 2+
- linux - 以 CSV 格式打印 JSON 中的所有键和值
- mysql - mysql时间格式只获取小时和分钟
- angular - 无法在角度 2 中实现 PUT 请求,出现错误“不允许空值”
- mongodb - 如何在mongodb中按降序显示记录