excel - 如何在空白行之间对单元格行进行分组
问题描述
所以我有一个包含不同值(无重复)的列的工作表,它们之间的空白行从第 13 行开始。
我需要分别对 D 列和 E 列中的值进行分组。E 列中的值在下一个值之前由两个空白行分隔,C 列中的值在下一个值之前由一个空白行分隔。
我认为我需要追求的代码逻辑应该类似于 Group cell E13 down 只要在空白行之前有一个值,跳过两个空白行然后冲洗并重复直到 E 列的最后一行。
除了我只跳过一行之外,我将对 D 列使用相同的逻辑。
Dim startrow as long
Dim grouplastrow as long
Dim startgroup as long
Dim blank as long
Startrow = 12
grouplastrow = .cells(rows.count,5).End(xlUp).row ‘finds last row in column E
startgroup = startrow + 1
I = startrow + 1 to grouplastrow ‘means the starting row starts at 13 and ends right at the last row with value, right?)
if cells(i,5)<> "" then 'if this cell has a value then...
'how do i say this is to start the range i want to group until cells(i,5)
'need to make it so that i either skip two rows or i begin the range again at the first cell with value....
range(.cells).group 'this will represent the range i'm grouping before the blank rows and loop until the last row
next i
解决方案
推荐阅读
- python - Python:从midi文件中获取正确的开始和结束
- python - 在python循环中重命名数据框
- javascript - 如何在 P5 js 中使用 sin(a) 和距离从 A 调制到 B?
- twitter-bootstrap - 为什么我的导航栏没有向右对齐?
- r - 如何根据 R 中的特定行值对列进行子集化?
- reactjs - 如何使用钩子和功能组件更改 flatList 中仅一项的样式
- javascript - useState 不会重新渲染
- hash - 使用巧克力安装软件时出现校验和错误
- javascript - 赛普拉斯/Javascript - 尝试单击尚未选择的按钮
- node.js - 猫鼬:findOne 填充条目不存在