Hey All,
Have a macros here that adds a new row and populates the first column with a code...
ActiveSheet.Unprotect
Rows(Range("A65536").End(xlUp).row).Copy Range("A65536").End(xlUp).Offset(1, 0)
Range("a65536").End(xlUp).Value = Range("F2").Value & "-" & Range("F3").Value & "-DS-" & Range("a65536").End(xlUp).row - 9
Range("e65536").End(xlUp).Value = ""
myrow = Range("A65536").End(xlUp).row - 1
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
The code produced looks something like '143232-133-DS-1' , where the '143232' and '133' come from cells F2 and F3. The incremental number comes from counting the rows in the sheet and where the data starts. Thing is, the first 99 codes need to have 3 digits at the end. So instead of '*-DS-1' it should be '*-DS-001' or '*-DS-026', etc.
How do I modify the code above to do that?
Have a macros here that adds a new row and populates the first column with a code...
ActiveSheet.Unprotect
Rows(Range("A65536").End(xlUp).row).Copy Range("A65536").End(xlUp).Offset(1, 0)
Range("a65536").End(xlUp).Value = Range("F2").Value & "-" & Range("F3").Value & "-DS-" & Range("a65536").End(xlUp).row - 9
Range("e65536").End(xlUp).Value = ""
myrow = Range("A65536").End(xlUp).row - 1
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
The code produced looks something like '143232-133-DS-1' , where the '143232' and '133' come from cells F2 and F3. The incremental number comes from counting the rows in the sheet and where the data starts. Thing is, the first 99 codes need to have 3 digits at the end. So instead of '*-DS-1' it should be '*-DS-001' or '*-DS-026', etc.
How do I modify the code above to do that?