|
- Sub jsm()
- Dim z&, crr, arr, i&, brr, rng As Range, t&
- Application.ScreenUpdating = False
- crr = ActiveSheet.UsedRange
- z = UBound(crr)
- arr = Range("A1").CurrentRegion
- i = UBound(arr)
- Do While i <= z
- i = i + 1
- t = i
- Do While Range("F" & t) = ""
- If t > z Then Exit Do
- If Range("F" & t).Rows.Count > 1 Or Range("F" & t).Columns.Count > 1 Then GoTo 100
- Range("F" & t).Value = "填"
- t = t + 1
- 100:
- Loop
- If t <= z Then
- If IsNumeric(Range("F" & t)) Then
- For Each rng In Range(Range("A" & t + 1), Range("G" & t + 1))
- If rng.Value <> "" Then
- s = s & rng.Value
- Exit For
- End If
- Next
- If s <> "" Then
- i = t + 2
- Else
- i = t + 1
- End If
- End If
- End If
- If IsNumeric(Range("D" & i - 1)) And Range("D" & i - 1) <> "" Then
- brr = Range("D" & i - 1).Resize(1, 3)
- Range("D" & i).Resize(1, 3).Value = brr
- Range("D" & i).Resize(1, 3).Interior.Color = vbYellow
- End If
- If IsNumeric(Range("D" & i - 2)) And Range("D" & i - 2) <> "" Then
- brr = Range("D" & i - 2).Resize(1, 3)
- Range("D" & i).Resize(1, 3).Value = brr
- Range("D" & i).Resize(1, 3).Interior.Color = vbYellow
- End If
- If i > z Then Exit Do
- Do While Range("A" & i).Value = ""
- Range("A" & i).Value = "填充"
- i = i + 1
- Loop
- arr = Range("A1").CurrentRegion
- i = UBound(arr)
- Loop
- For Each rng In ActiveSheet.UsedRange
- If rng.MergeArea.Rows.Count = 1 And rng.MergeArea.Columns.Count = 1 Then
- If rng.Value = "填充" Or rng.Value = "填" Then
- rng.Value = ""
- End If
- End If
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|