User Tools

Site Tools


microsoft_excel:macro_adds_zeros_to_the_front_of_a_number

This is an old revision of the document!


Microsoft Excel - Macro Adds 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
microsoft_excel/macro_adds_zeros_to_the_front_of_a_number.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki