乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>excel</em>宏或者<em>vba</em>,怎么把包含特

<em>excel</em>宏或者<em>vba</em>,怎么把包含特

作者:乔山办公网日期:

返回目录: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行。

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网