Sub 清理多余表头()
Const firstRow As Integer = 2 '声明起始行变量
Dim lastRow As Integer '声明最后一行变量
Dim a As Integer
lastRow = firstRow + ActiveSheet.UsedRange.Rows.Count - 1
For a = firstRow To lastRow
If Rows(a).Cells(2) = "月份" Then
Rows(a).Delete
End If
Next
End Sub
Sub 合并SKU()
Const firstRow As Integer = 2 '声明起始行变量
Dim lastRow As Integer '声明最后一行变量
Dim a As Integer
lastRow = ActiveSheet.UsedRange.Rows.Count - 1
Dim beginIndex As Integer
Dim region As String
For a = firstRow To lastRow
If Rows(a).Cells(1) <> "" Then
If beginIndex = 0 Then
beginIndex = a
End If
If a > 2 Then
region = "A" & beginIndex & ":A" & (a - 1)
'MsgBox region
Range(region).UnMerge
beginIndex = a
End If
End If
Next
region = "A" & beginIndex & ":A" & a
'MsgBox region
Range(region).UnMerge
End Sub
Sub 合并后添加填充SKU()
Const firstRow As Integer = 2 '声明起始行变量
Dim lastRow As Integer '声明最后一行变量
Dim a As Integer
lastRow = ActiveSheet.UsedRange.Rows.Count
Dim value As String
For a = firstRow To lastRow
If Rows(a).Cells(1) = "" Then
Rows(a).Cells(1) = value
Else
value = Rows(a).Cells(1)
End If
Next
End Sub