Object Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pookaroo85
    New Member
    • Nov 2013
    • 34

    Object Error

    I am working in Excel 2010 and am trying to print a report from another tab only if a specific cell is within a specific range. When I click the 'Print' button I get "Run-time error '424': Object required" when it gets to my LOW and HIGH strings. I do not know how to fix this. Any clues would be appreciated.

    Code:
    Sub PRINT_SLURRY_Click()
     
        'Prints batch ticket from different tab
        Dim LOW As String
        Dim HIGH As String
        
        LOW = Application.WorksheetFunction.VLookup(Range("C7"), Sheet.TANKS.Range("A:D"), 3, False)
        HIGH = Application.WorksheetFunction.VLookup(Range("C7"), Sheet.TANKS.Range("A:D"), 4, False)
        
        If Range("C10") < LOW Or Range("C10") > HIGH Then
            MsgBox "Batch Size is not within range!"
        Else
            Sheets("BATCH TICKET").Select
            Application.Dialogs(xlDialogPrintPreview).Show
        End If
        
        'Clears contents in form
        Worksheets("FORM").Range("C7:C8").ClearContents
        Worksheets("FORM").Range("C10").ClearContents
    
        'Sets focus back to MAIN SCREEN tab
        Sheets("MAIN SCREEN").Select
    
    End Sub
  • Pookaroo85
    New Member
    • Nov 2013
    • 34

    #2
    I figured it out. I changed...
    Code:
    LOW = Application.WorksheetFunction.VLookup(Range("C7"), Sheet.TANKS.Range("A:D"), 3, False)
     8.     HIGH = Application.WorksheetFunction.VLookup(Range("C7"), Sheet.TANKS.Range("A:D"), 4, False)
    to...
    Code:
        LOW = Application.WorksheetFunction.VLookup(Sheets("FORM").Range("C7"), Sheets("TANKS").Range("A:D"), 3, False)
        HIGH = Application.WorksheetFunction.VLookup(Sheets("FORM").Range("C7"), Sheets("TANKS").Range("A:D"), 4, False)

    Comment

    Working...