作者:乔山办公网日期:
返回目录:excel表格制作
楼上说的抄替换袭更简单,一百定需要度VBA的话,代知码如下:道
Option Explicit
Sub 宏1()
Dim arr, i, n, x
n = Range("f1").End(xlDown).Row
arr = Range("f1").Resize(n, 1)
For i = 1 To n
x = InStr(arr(i, 1), "组")
If x > 0 Then arr(i, 1) = Left(arr(i, 1), x)
Next i
Range("f1").Resize(n, 1) = arr
End Sub
你里面的Fail是单元格里面类容的全部吗或者Fail只是一部e799bee5baa6e79fa5e98193e4b893e5b19e361分?
如果是这样可以使用 VBA制作
第一步:去掉所有带Fail的行.
第二步:去掉重复行.
数据在A列,关键字Fail在B列,如下代码去除A列重复,去除B列包含Fail:
~~~~~~~~~~~~~~~~
Sub ChekingKeyWordsAndKeepOnly()
Dim i, j
i = 1
While Cells(i, 1) <> ""
For j = 1 To 10
If LCase(Cells(i, j).Value) = LCase("FAIL") Then
Rows(i).Delete
Exit For
End If
If j = 10 Then
i = i + 1
End If
Next j
Wend
i = 1
While Cells(i, 1) <> ""
j = i + 1
While Cells(j, 1) <> ""
If Cells(j, 1).Value = Cells(i, 1).Value Then
Cells(j, 1).Delete
Else
j = j + 1
End If
Wend
i = i + 1
Wend
End Sub
Sub Macro1()
A = InputBox("请输来入需要删除包含的某特定字符", "输入框", v)
j = Trim(InputBox("请输入需要选自择的列号zd", "输入框", 1))
For k = j To j
For i = 1 To 65535
Sheets(1).Cells(i, k).Select
If Len(Sheets(1).Cells(i, k).Value) = 0 Then
Exit For
End If
If InStr(Sheets(1).Cells(i, k).Value, A) <> 0 Then
B = i & ":" & i
Sheets(1).Rows(B).Select
Selection.Delete Shift:=xlUp
End If
Next i
Next k
Sheets(1).Cells(i, k).Select
MsgBox "删除操作完成!"
End Sub
Sub 清除知()
For k = 1000 To 60 Step -1
If (Cells(k, 1) = -5 And Cells(k, 2) = 80) Or (Cells(k, 1) = 25 And Cells(k, 2) = 64) Then
Cells(k, 1).EntireRow.ClearContents
End If
Next
End Sub
功能区道域为第内容60-1000行。