Results 1 to 9 of 9

Thread: run time error 13 Type mismatch

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    run time error 13 Type mismatch

    Please i need help. my Excel VBA Application is giving this message

    run time error 13 Type mismatch



    Sub show_inventory()
    
    Dim sh As Workbook
    Set sh = ThisWorkbook.Sheets("Inventory")
    
    sh Cells.Clear
    ThisWorkbook.Sheets("Product_master").Range("B:B").Copy sh.Range("A1")
    sh.Range("B1").Value = "Purchase"
    sh.Range("C1").Value = "Sale"
    sh.Range("D1").Value = "Available Stock"
    sh.Range("E1").Value = "Stock Value"
    
    Dim lr As Long
    lr = Application.WorksheetFunction(sh.Range("A:A"))
    
    If lr > 1 Then
    sh.Range("B2").Value = "=SUMIFS(SALE_PURCHASE!D:D,SALE_PURCHASE!B:B,INVENTORY!A2,SALE_PURCHASE!C:C,""PURCHASE"")"
    sh.Range("C2").Value = "=SUMIFS(SALE_PURCHASE!D:D,SALE_PURCHASE!B:B,INVENTORY!A2,SALE_PURCHASE!C:C,""SALE"")"
    sh.Range("D2").Value = "B2-C2"
    sh.Range("E2").Value = "=VLOOKUP(A2,PRODUCT_MASTER!B:C,2,0)*D2"
    
    If lr > 2 Then
    sh.Range("B2:E" & lr).FillDown
    
    sh.Calculate
    End If
    
    sh.UsedRange.Copy
    sh.UsedRange.PasteSpecial xlPasteValues
    
    Dim inv_Display As Worksheet
    Set inv_Display = ThisWorkbook.Sheets("Inventory_Display")
    inv_Display.Cells.Clear
    
    If Me.Txt_Search.Value <> "" Then
        sh.UsedRange.AutoFilter 1, "*" & Me.Txt_Search.Value & "*"
    End If
    
    sh.UsedRange.Copy inv_Display.Range("A1")
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •