颜色分两种
一种 是常规填充的
一种 是条件格式返回的
如果是条件格式返回的,难度比较大
两种都是用VBA来做
如下:
Sub 宏1()
Dim i As Integer, j As Long
For i = 70 To 11 Step -1
For j = 1 To 65536
If Cells(j, i).Interior.ColorIndex <> -4142 Then ' ±³¾°µÄÑÕɫΪÎÞÉ«
Range(Cells(1, i), Cells(4, i)).Select
Selection.Delete Shift:=xlToLeft
Exit For
End If
Next
Next
End Sub
如下:
Sub 宏1()
Dim i As Integer, j As Long
For i = 70 To 11 Step -1
For j = 1 To 65536
If Cells(j, i).Interior.ColorIndex <> -4142 Then
Range(Cells(1, i), Cells(4, i)).Select
Selection.Delete Shift:=xlToLeft
Exit For
End If
Next
Next
End Sub