Results 1 to 8 of 8

Thread: how to sum a multiline cell?

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2016
    Posts
    10

    how to sum a multiline cell?

    Hey guys,

    Since i made a qoutation system for my boss i'm working with excel 'nd stuff, and it is going pretty well.
    I'm able to add products to a datagridview and export this dgv to excel.

    In this picture you see my excel file which has the exported products in it
    Name:  fout1.jpg
Views: 455
Size:  24.9 KB

    As you can see, in cell C17, the text is based on the ALT+Enter function.

    The code which exports the products is the following:

    Some explaination with the codes:
    I wanted to make a qoutation which has 5 categories with it. "Riolering" is one of the categories. Thats why i used the if-loop.
    Little translation to understand:
    artikelnaam = productname
    hoeveelheid = quantity
    eenheid = unit
    prijs = price

    in this script i translated a little of the dutch words, to make it easier to understand.
    Code:
    For cnt = 0 To (artikelengrid.Rows.Count - 1)
                            Dim productname As String = artikelengrid.Rows(cnt).Cells(0).Value.ToString()
                Dim category As String = artikelengrid.Rows(cnt).Cells(1).Value.ToString()
                Dim ehd As String = artikelengrid.Rows(cnt).Cells(2).Value.ToString()
                Dim qty As String = artikelengrid.Rows(cnt).Cells(3).Value.ToString()
    
    .....
    
      ElseIf category = "Riolering" Or categorie = "riolering" Then
                    xlWorkSheetProducten.Range("A20").Value = "Riolering"
                    xlWorkSheetProducten.Range("A21").WrapText = True
                    xlWorkSheetProducten.Range("A21").Rows.AutoFit()
                    xlWorkSheetProducten.Range("A21").Value += "* " + artikelnaam + vbLf
                    xlWorkSheetProducten.Range("B21").Value += hoeveelheid + vbLf
                    xlWorkSheetProducten.Range("C21").Value += "€" + prijs + "/" + eenheid + vbLf
                    xlWorkSheetProducten.Range("D21").Value += totaalprijs + vbLf
                    xlWorkSheetProducten.Range("A20").Font.Underline = XlUnderlineStyle.xlUnderlineStyleSingle
    As you can see in the picture, is cell 19 for the total of the products. Sorry for the language, i hope it doesn't bother you guys.

    But due the multiline cell 17, it wouldn't let me sum up these prices, how is that possible? And is there a way to fix that?
    Or is it in the code, that i did something wrong.

    I hope you guys can help me, and if you need more information, i'll give it to you.

    Gz!

    Jaspertje
    Attached Images Attached Images  

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width