|
今一効率のよさそうな物が思い浮かびませんでした。
Sub aaaaaaa()
Dim TB(1 To 3) As Variant, St As Long, FC As Long
Dim ColM As Variant, i As Integer
St = 2: FC = 1
Do
FC = FC + 1
TB(1) = Application.Match("フラグ" & FC, Columns(2), 0)
TB(2) = Application.Match("フラグ" & FC, Columns(4), 0)
TB(3) = Application.Match("フラグ" & FC, Columns(6), 0)
If IsError(TB(1)) Or IsError(TB(2)) Or IsError(TB(3)) Then
Erase TB
Exit Sub
End If
Application.ScreenUpdating = False
ColM = Application.Min(TB)
For i = 2 To 6 Step 2
Do
'Cells(ColM, i).Select
If Not (Cells(ColM, i).Value Like "フラグ*") Then
Cells(ColM, i).Delete
Else
Exit Do
End If
Loop
Next
St = ColM
Loop
Application.ScreenUpdating = True
Erase TB
End Sub
|
|