本帖最后由 lss001 于 2017-3-17 22:57 编辑
Sub 宏1() '赋值
For i = 2 To 7
x = Cells(Rows.Count, 5).End(xlUp).Row
If Mid(Cells(1, i), 6, 1) = "4" Then
Range(Cells(1, 9), Cells(x, 9)) = Range(Cells(1, i), Cells(x, i)).Value
End If
Next
End Sub
Sub 宏2() '复制
For i = 2 To 7
x = Cells(Rows.Count, 5).End(xlUp).Row
If Mid(Cells(1, i), 6, 1) = "4" Then
Range(Cells(1, i), Cells(x, i)).Select
Selection.Copy
Range("I1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("J1").Select
End Sub
'任选一个都可以!!! |