|
根据实际情况,删除空白行,再根据条件合并单元格。怎样根据条件判断需合并的范围。
Sub DeleteRow1()
Application.ScreenUpdating = False
'Dim EndRow As Single, Cor As String
Dim i, j, k As Integer, a As Variant
' Cor = ",1,3,4,6,13,14,16,17,26,28,38,46,47,48,54,"
'j = Worksheets.Count
Sheets("装箱单").Activate
With ActiveSheet
For k = 54 To 3 Step -1
If Cells(k, "A") = "" Then
Rows(k).Delete
End If
Next
End With
End Sub
Sub hebingD()
For i = 3 To Sheets("装箱单").Range("a65535").End(xlUp).Row ' 可依据 实际范围修改
If Sheets("装箱单").Range("D" & i) <> "" Then '判断A列,可依据实际修改
j = i
Else
Application.DisplayAlerts = False
Range("D" & j & ":D" & i).Merge '判断A列,可依据实际修改
Application.DisplayAlerts = True
End If
Next
End Sub
Sub hebingE()
For i = 3 To Sheets("装箱单").Range("a65535").End(xlUp).Row ' 可依据 实际范围修改
If Sheets("装箱单").Range("E" & i) <> "" Then '判断A列,可依据实际修改
j = i
Else
Application.DisplayAlerts = False
Range("E" & j & ":E" & i).Merge '判断A列,可依据实际修改
Application.DisplayAlerts = True
End If
Next
End Sub
|
|