Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2018
    Posts
    21
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Run Time Error 424

    dears i have a problem with below , when i click run error 424 showing

    issue here
    Code:
    data.Range(Cells(row, 1), Cells(row, 3)).Copy Destination:=Report.Cells(erow, 1)

    complete code
    Code:
    Private Sub cmdgen_Click()
    Dim i As Long, lastrow As Long, qtyPurchased As Long, row As Long, qtySold As Long, qtyInStock As Long
    Dim inventoryid As String
    lastrow = Sheets("Data").Range("A" & Rows.Count).End(xlUp).row
    Dim erow As Long
    erow = Sheets("Report").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).row
    qtyPurchased = 0
    qtySold = 0
    qtyInStock = 0
    
    inventoryid = ComboBox8.Value
    For i = 3 To lastrow
        If Cells(i, 1) = inventoryid Then
            qtyPurchased = qtyPurchased + Cells(i, 9)
            qtySold = qtySold + Cells(i, 23)
            row = i
        End If
        
    Next i
    
    
    data.Range(Cells(row, 1), Cells(row, 3)).Copy Destination:=Report.Cells(erow, 1)
    Application.CutCopyMode = False
    Report.Cells(erow, 9) = qtyPurchased
    Report.Cells(erow, 10) = qtySold
    qtyInStock = qtyPurchased - qtySold
    Report.Cells(erow, 11) = qtyInStock
    End Sub
    Kind Regards
    Mufa

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,434
    Thanks
    3
    Thanked 258 Times in 236 Posts
    Unless Data and Report are also the codenames of the sheets in question, you have to use Sheets("Data") and Sheets("Report").
    Regards,
    Rory

  3. The Following User Says Thank You to rory For This Useful Post:

    mufa (2018-12-06)

  4. #3
    New Lounger
    Join Date
    Nov 2018
    Posts
    21
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Thank you Dear Rory its working fine

    But i have one issue , i want make some changes in generating report , now I'm not getting the correct calculation.

    can you please check attached WB
    Invy2 wms.xlsm

    i need report like this
    screen shot.JPG
    Kind Regards
    Mufa

Posting Permissions

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