Excel宏开发之合并单元格
2024-09-02 23:32:57
合并单元格
Sub 宏1()
'
' 宏1 宏
'
' 快捷键: Ctrl+q
'
Application.Goto Reference:="宏1"
Application.VBE.MainWindow.Visible = True Application.DisplayAlerts = False For i = [A65536].End().Row To Step -
If Cells(i - , ) = Cells(i, ) Then
Cells(i - , ).HorizontalAlignment = xlCenter
Cells(i - , ).VerticalAlignment = xlCenter
Range(Cells(i - , ), Cells(i, )).Merge
End If
Next For i = [B65536].End().Row To Step -
If Cells(i - , ) = Cells(i, ) Then
flag = True
If (Cells(i, ) <> "") Then
flag = False
End If
If flag Then
Cells(i - , ).HorizontalAlignment = xlCenter
Cells(i - , ).VerticalAlignment = xlCenter
Range(Cells(i - , ), Cells(i, )).Merge
End If
End If
Next For i = [C65536].End().Row To Step -
If Cells(i - , ) = Cells(i, ) Then
flag = True
If (Cells(i, ) <> "") Then
flag = False
End If
If flag Then
Cells(i - , ).HorizontalAlignment = xlCenter
Cells(i - , ).VerticalAlignment = xlCenter
Range(Cells(i - , ), Cells(i, )).Merge
End If End If
Next Application.DisplayAlerts = True Application.VBE.MainWindow.Visible = False
End Sub
最新文章
- maven官方库中没有oracle jdbc驱动的问题解决
- (转)RVA-相对虚拟地址解释
- HashMap和HashSet
- laravel 中 与前端的一些事4 之合并压缩静态文件
- java执行时的两个常见问题(无法加载主类)
- java基础:数据类型
- 微软 Virtual studion Code
- POJ_2914_Minimum_Cut_(Stoer_Wagner)
- 用Ajax去读取服务器端的XML格式的数据
- Android开发之InstanceState详解(转)
- hdu 1258 DFS
- C++使用函数模板
- java读取properties 文件信息
- [置顶] 使用Android OpenGL ES 2.0绘图之五:添加运动
- spell checking
- message:GDI+ 中发生一般性错误。
- springboot 如何操作redis
- ecplise debug 无法命中断点 一直在加载中
- 【LOJ】#2567. 「APIO2016」划艇
- Website Develop: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list