I have a string of test that I am trying to just copy out item numbers and such. Each item number has differing lengths and some of the item numbers have leading zeros. When I run the macro it is dropping some of the leading zeros off some of the items. I am sure it is the way I have written the macro, see blow.
VBA Code:
Sub Button1_Click()
For x = 1 To 60000
A = Sheet2.Cells(1048576, 1).Value
If Sheet1.Cells(x, 2).Value > 1 And Sheet1.Cells(x, 3).Value > 1 And Sheet1.Cells(x, 4).Value > 1 And Sheet1.Cells(x, 2).Value <> "PART" And Sheet1.Cells(x, 2).Value <> "NO.#" Then
Sheet2.Cells(A + 1, 1).Value = Sheet1.Cells(x, 2).Value
Sheet2.Cells(A + 1, 2).Value = Sheet1.Cells(x, 3).Value
Sheet2.Cells(A + 1, 3).Value = Sheet1.Cells(x, 4).Value
Sheet2.Cells(A + 1, 4).Value = Sheet1.Cells(x, 5).Value
End If
Next x
End Sub
Last edited by a moderator: