'Type mismatch when list box is empty

I have some code which works perfectly in submitting the contents of three list boxes that are within a form when they contain data, however when the list boxes are empty I am presented with a type mismatch error.

For i = LBound(Me.PartNoList.List) To UBound(Me.PartNoList.List)
        parts = parts & IIf(parts = "", "", vbNewLine) & Me.PartNoList.List(i, 0)
            Next

              With Sheets("Sales Order Log").Range("Sales_Data_Start")
                .Offset(TargetRow, 1).Value = SalesOrderNo
                    ' (...)
                        .Offset(TargetRow, 5).Value = parts
                            End With

    For i = LBound(Me.PartDescList.List) To UBound(Me.PartDescList.List)
        descparts = descparts & IIf(descparts = "", "", vbNewLine) & Me.PartDescList.List(i, 0)
                Next

                With Sheets("Sales Order Log").Range("Sales_Data_Start")
                    .Offset(TargetRow, 1).Value = SalesOrderNo
                        ' (...)
                            .Offset(TargetRow, 6).Value = descparts
                                End With

    For i = LBound(Me.PartQntList.List) To UBound(Me.PartQntList.List)
        qntparts = qntparts & IIf(qntparts = "", "", vbNewLine) & Me.PartQntList.List(i, 0)
            Next

                With Sheets("Sales Order Log").Range("Sales_Data_Start")
                    .Offset(TargetRow, 1).Value = SalesOrderNo
                        ' (...)
                            .Offset(TargetRow, 7).Value = qntparts
                                End With

Any help in diagnosing why this is happening would be very much appreciated.



Solution 1:[1]

In your css file you use translate to center a heading which is wrong practice.
Assuming that your heading is in a div, you can center it with text-align:center;
If you want to vertically align it, you will need to use Flexbox or Grid.

To solve your problem, change your .sec2 css class to this:

.sec2{
    color: rgb(255, 0, 0);
    font-size: 80px;
    font-family: 'Nunito', sans-serif;
    text-align: center;
}

As stated, you must add your code in your question.

Solution 2:[2]

Please add some CSS into your stylesheet I hope it will work.

body{
     overflow-y: scroll;
     overflow-x: hidden;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 George Chond
Solution 2 Monzur Alam