run time error 13 type mismatch vb excel

alekzandrei delos reyes 1 Reputation point
2021-02-22T11:51:25.38+00:00

I cant seem to find where the error is can someone help me Sub show_Inventory() Dim sh As Worksheets 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 Stocks" 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,A2,Sale_Purchase!C:C,""Purchase"")" sh.Range("C2").Value = "=SUMIFS(Sale_Purchase!D:D,Sale_Purchase!B:B,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 End If 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") ''''''''''''''' show data lr = Application.WorksheetFunction(Inv_Display.Range("A:A:")) If lr = 1 Then lr = 2 With Me.ListBox1 .ColumnCount = 5 .ColumnHeads = True .ColumnWidths = "120,0,0,70,0" .RowSource = Inv_Display.Name & "!A2:E" & lr End With End Sub

{count} votes