Microsoft Excel - Macros - Padding - Add zeros to the front of a number

' Adds 0's to the front of the number.
Dim x
For i = 2 To lastrow_sheet1
  txt = .Range("N" & i).Value
  If Len(txt) < 7 Then
    For x = 1 To (7 - Len(txt))
      txt = "0" & txt
    Next x
  End If
 
  If IsNumeric(txt) Then
    txt = "'" & txt
  End If
 
  .Range("N" & i) = txt
Next i