当前位置: 代码迷 >> VBA >> VBA 雷同内同 合并
  详细解决方案

VBA 雷同内同 合并

热度:8542   发布时间:2013-02-26 00:00:00.0
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
  相关解决方案