See inline comment...
"Rick Rothstein (MVP -
VB)" wrote in
message ...
Column C contains string IDs with a varying number of blank cells between
each.
Having found the last entry in column E and the latest ID with:
iDoorRow = Sheets("Pages").Cells(Rows.Count, 5).End(xlUp).Row
sDoorName = Sheets("Pages").Cells(iDoorRow, 5)
how can I increment the string (sDoorName) (in this case D02-003) to
D02-004?
Then I can prompt the user to confirm that as the next door or to type in
D03-001 to start the next sequence or whatever.
You can use this function to return the next number in the sequence (if it
is 000
The above sentence was supposed to say, at the end, "if it returns "000", it
means the inputted DoorName ended with 999, so there isn't a next number
unless you have code to automatically switch to the next sequence".
Rick
Function NextName(sDoorname As String) As String
NextName = sDoorname
Mid(NextName, 5) = Format((Val(Mid(NextName, 5)) + 1) Mod 1000, "000")
End Function
Or, if you are not repeating the process several times, embed the two
lines from the function directly in your code (making sure you Dim the
NextName variable in that case).
Rick