读书人

VBA 雷同内同 合并

发布时间: 2012-12-16 12:02:32 作者: rapoo

VBA 相同内同 合并
vba中 相同内容的单元格 合并
[解决办法]
该回复于2011-03-22 14:54:03被版主删除
[解决办法]

引用:
不懂VBA,帮顶!

刚刚你说的就是VBA啊 大哥...
[解决办法]
这个题目太泛泛了。最好有实例。这么问估计没有能做出来。
[解决办法]
诶 我已经解决了 用了递归 呵呵
Public Function wugui(colNum As Integer, rowNum As Integer, allNum As Integer) As Integer

Dim x As Integer
Dim y As Integer
Dim digui As Integer
digui = 0

y = Cells(rowNum, colNum)

Do While colNum <= allNum + 1

If (y = Cells(rowNum, colNum + 1)) Then

'If (j >= 10) Then MsgBox j

Cells(rowNum, colNum + 1).Select
Selection.ClearContents

Range(Cells(rowNum, colNum), Cells(rowNum, colNum + 1)).Select
Selection.Merge
Else:
digui = colNum + 1
Exit Do
End If

colNum = colNum + 1
Loop

If (digui < allNum - 1) Then
x = wugui(digui, rowNum, allNum)
End If

End Function
[解决办法]
null
[解决办法]
null

读书人网 >VBA

热点推荐