-1

I have numerous sheet in a excel workbook. I am comparing from my active sheet "APP and APP Codes" to all other sheets in active. i am comparing first column from each sheet then writing sheet name in H column in sheet "APP and APP Codes".

Option Explicit
Sub find()
    Dim i, n As Long
    Dim sheets As Variant
    Dim sheet As Variant
    Dim ws As Worksheet
    Dim SheetLookupRange As Range
    Dim NumberOfValues2 As Integer
    Dim myvalue, value2 As String
    Dim check As Boolean
     
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.EnableEvents = False

    sheets = Array("JCBAMR300P", "MNBAMR302P", "MNBAMR303P", "PPBAMR302P")
    Set ws = ThisWorkbook.sheets("APP and APP Codes")
    For i = 2 To ThisWorkbook.sheets("APP and APP Codes").Range("A2").End(xlDown).Row
             check = False
             myvalue = ws.Cells(i, 1)
            For Each sheet In sheets
                        NumberOfValues2 = sheet.Range("A2").End(xlDown).Row
                         If check = False Then
                         For n = 2 To NumberOfValues2
                        value2 = sheet.Cells(n, 1)
                                If myvalue = value2 Then
                                        ws.Range("F" & i).Value = sheet.Name
                                        check = True
                                       End If
                         Next
                         End If
            Next
    Next
             
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub

I am getting object required message at below line, any idea ??? sheet.Range("A2").End(xlDown).Row

user692942
  • 15,667
  • 7
  • 74
  • 164

0 Answers0