[Solved] Do While Loop for SKU numbers


No need to use the Do Loop. Find the last row and then use a For loop.

Is this what you are trying?

Sub Sample()
    Dim ws As Worksheet
    Dim lRow As Long, i As Long

    '~~> Change this to the relevant sheet
    Set ws = ThisWorkbook.Sheets("Sheet2")

    With ws
        '~~> Find last row
        lRow = .Range("A" & .Rows.Count).End(xlUp).Row

        For i = 1 To lRow
            If .Cells(i, 1) <> "" And .Cells(i, 2) <> "" And .Cells(i, 3) <> "" Then

                '0{(###)col1}{(##)col2}{(##)col3}0
                .Cells(i, 4).Value = "'0" & _
                                     Format(.Cells(i, 1), "000") & _
                                     Format(.Cells(i, 2), "00") & _
                                     Format(.Cells(i, 3), "00") & _
                                     "0"
            End If
        Next i
    End With
End Sub

Output for 28,6,58 is 002806580

0

solved Do While Loop for SKU numbers