Excel Macro

Question: Which Great God?
Two EXCEL tables A and B both contain column a (such as name) with the same content. How to filter out the rows in table A that have the same content as column a in table B?
Macros also do, functions do?

Answer:
Dim lie1 As Integer
Dim lie2 As Integer

lie1 = 7 'Here fill in the length of column 1
lie2 = 3 'Here fill in the length of column 2

Dim i As Integer
Dim j As Integer
Dim str1 As String
Dim str2 As String
For i = lie1 To 1 Step -1
     Sheets("Sheet1").Select 'The name of sheet 1 is in the double quotation marks here
    str1 = Range("A" & i).Text 'Here fill in the column
    Sheets(" Sheet2").Select 'Here is the name of sheet 2 in double quotes
    For j = lie2 To 1 Step -1
       str2 = Range("A" & j).Text 'Here fill in the column where column 2 is located
       If str1 = str2 Then
        Sheets("
          Range("A" & i).FormulaR1C1 = "" 'Here fill in the column where column 1 is located
          Exit For
       End If
    Next
Next

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327043580&siteId=291194637