assistance with syntax error (teaching myself VB)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: assistance with syntax error (teaching myself VB)

  1. #1
    Join Date
    Apr 2011
    Posts
    3

    assistance with syntax error (teaching myself VB)

    Trying to sum a range of cells on different sheet, where the upper and lower rows changes. I'm getting a the syntax error "run-time error '1004': application-defined or object-defined error" for the following line of code:


    total_inven_lbs = Application.WorksheetFunction.Sum(Sheets("batchDetails").Range(Cells(newRow_batchDetails, 8), Cells(latestBatchrow_batchDetails, 8)))

    Been a few hours already trying to research and solve.

    Thanks.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    Re: assistance with syntax error (teaching myself VB)

    We need much more info that what you gave, please

  3. #3
    Join Date
    Apr 2011
    Posts
    3

    Re: assistance with syntax error (teaching myself VB)

    Hannes, many thanks for the reply. I'm trying to build a model that to begin with will track inventory uses and at the same time calculate an average cost of inventory in stock. I'm running to issue and the average cost calculation. I have attached a stripped down version of the model . On the "batch details" tab there can be several different batches of raw material sitting inventory, but current production would only be pulling from one batch at a time - average cost of remaining inventory would then be recalculated every time inventory is used.

    Dim total_inven_lbs As Integer [ln 60]

    total_inven_lbs = Worksheets("batch details").Cells(newRow_batchDetails, 10).Value [ln 180]

    total_inven_lbs = Application.Sum(Range(Worksheets("batch details").Cells _
    (newRow_batchDetails, 8).Value, Worksheets("batch details").Cells _
    (latestbatchrow_batchDetails, 8).Value)) [ln199]
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2011
    Posts
    3

    Re: assistance with syntax error (teaching myself VB)

    this has been resolved. thanks.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center