My sequence will be something like 0000-16x, 0001-16x, 0002-16x, … ,9999-16x
I want to write a macro that will read one of the values and increment it by one. e.g. if it reads 0014-16xthe code will return 0015-16x
My code works only if the contents of cell are all numbers
Dim name As Variant
name = ActiveCell
name = name + 1
ActiveCell.Offset(1, 0).Activate
ActiveCell.FormulaR1C1 = name
How can I increment a sequence like the one I have? Thanks
FormulaR1C1seems overkill in this case; you could be assigning the cell'sValuedirectly. That said, with a UDF such as Tim's solution that becomes irrelevant.