1 Attachment(s)
run time error 13 Type mismatch
Please i need help. my Excel VBA Application is giving this message
run time error 13 Type mismatch
Code:
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")
1 Attachment(s)
Compile erro:r Method or data member nor found
please help me on this:
Compile error
Method or data member nor found
Code:
Sub show_Numbers()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Report")
sh.Range("C1").Value = Me.txt_Start_Date.Value
sh.Range("C2").Value = Me.txt_End_Date.Value
sh.Calculate
Me.Lbl_Purchase.Caption = sh.Range("C4").Value
Me.lbl_Sale.Caption = sh.Range("C5").Value
Me.lbl_Profit.Caption = sh.Range("C6").Value
Me.lbl_Inventory_Qty.Caption = sh.Range("C7").Value
Me.lbl_Inventory_Amt = sh.Range("C8").Value
End Sub