Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Application Defined or Object Defined Error
#1
I'm really new to using macros and i'm trying to find and sort a list in excel. The location of the cells fall directly below a heading in column A called Quality Assurance. The location and lenth of this list is completely variable.

I'm getting an error: 1004 Application Defined or Object Defined Error

Here's the code...Any help would be great!
Code:
Copy      Help
Sub QA()
'
' QA Macro
' Macro recorded 12/22/2008 by HFCMM803
'
    Dim QA As Integer
    Dim Plus_one As Integer
    Dim NQA As Integer
    Dim Hit As Boolean
    Dim QARange As Integer
    Dim Cover As String
    
    Hit = False
    
    temp = Range("A500").End(xlUp).Row
    For x = 1 To temp
    Cells(x, 1).Select
    If Cells(x, 1) = "QUALITY ASSURANCE" Then
    QA = x
    End If
    Next x
    
    
    Plus_one = QA + 1

    temp = Range("A100").End(xlUp).Row
    For y = Plus_one To temp
        Cells(y, 1).Select
    If Cells(y, 1) <> "" And Hit = False Then
        NQA = y
        Hit = True
    End If
    Next y
    
    QARange = NQA - QA
    Cover = "G" & QARange
    Range("A" & QA).Select
    ActiveCell.Offset(0, 1).Range("A1:" & Cover).Select
    Selection.Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
  
End Sub


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)