excel 自动group脚本
来源:互联网 发布:算法的定义和特征 编辑:程序博客网 时间:2024/06/06 16:35
Sub autogroup()
Dim k
With ActiveSheet.Outline
.AutomaticStyles = False
.SummaryRow = xlAbove
.SummaryColumn = xlRight
End With
max_rows = ActiveSheet.UsedRange.Rows.Count
max_cols = ActiveSheet.UsedRange.Columns.Count
Range(Cells(1, 1), Cells(max_rows, 1)).ClearOutline
Range("A" & max_rows + 1).Value = 1
For ii = 2 To max_cols - 2
i = max_cols - ii
For j = 1 To max_rows + 1
If Application.CountIf(Range(Cells(j, 1), Cells(j, i)), "<>") = 0 Then
If (flag = 1) Then
k = k
Else
k = j
End If
flag = 1
ElseIf (flag = 1) Then
Range(Cells(k, 1), Cells(j - 1, 1)).Rows.Group
k = 1
flag = 0
End If
Next
Next
Range("A" & max_rows + 1).Value = ""
End Sub
Dim k
With ActiveSheet.Outline
.AutomaticStyles = False
.SummaryRow = xlAbove
.SummaryColumn = xlRight
End With
max_rows = ActiveSheet.UsedRange.Rows.Count
max_cols = ActiveSheet.UsedRange.Columns.Count
Range(Cells(1, 1), Cells(max_rows, 1)).ClearOutline
Range("A" & max_rows + 1).Value = 1
For ii = 2 To max_cols - 2
i = max_cols - ii
For j = 1 To max_rows + 1
If Application.CountIf(Range(Cells(j, 1), Cells(j, i)), "<>") = 0 Then
If (flag = 1) Then
k = k
Else
k = j
End If
flag = 1
ElseIf (flag = 1) Then
Range(Cells(k, 1), Cells(j - 1, 1)).Rows.Group
k = 1
flag = 0
End If
Next
Next
Range("A" & max_rows + 1).Value = ""
End Sub
阅读全文
0 0
- excel 自动group脚本
- excel自动填充脚本(awk)
- excel in group discussion
- ldap迁移脚本group
- 自动脚本
- 使用Excel宏录制了解VBA的API以及文件打开自动运行脚本
- EXCEL非规整数据无法通过拖动而自动填充公式的脚本方法
- IP地址最后一位自动增加为3位的EXCEL脚本
- excel 2010 group and subtotal function
- C# EXCEL 分组 Range.Rows.Group()
- Excel实现select...group by的功能
- Excel 實現類似 count..group by.. 的效果
- 脚本中的几个group的解析
- EXCEL脚本操作
- Excel 脚本编写
- Excel常用脚本
- [EventProxy(二)]EventProxy之group自动排序
- 自动分表--EXCEL
- React Native 嵌入到原生应用
- 喷水装置一
- GTK编译后运行出现: GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion 'G_IS_DBUS_CONNECTION
- PHP向数组中添加元素
- OSGi框架与类加载器
- excel 自动group脚本
- hdu 6035 Colorful Tree(树形DP)
- postgresql的json操作
- mybatis+oracle+foreach list 批量插入数据
- Java 设计模式_适配器模式
- 微信开发 现金红包、裂变红包、企业付款
- 2017 Multi-University Training Contest
- 用C语言程序判断一个字符是否是字母或数字
- Javascript闭包