View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Incrementing a string

sZeroes = "0000000000"
sSuffix = Right(sDoorname, Len(sDoorname) - InStr(sDoorname, "-"))
sNextDoorname = Left(sDoorname, InStr(sDoorname, "-")) & Format(sSuffix +
1, Left(sZeroes, Len(sSuffix)))


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Francis Hookham" 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.

Francis Hookham