View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Advancing A Number With The Push A Button

Private Sub GetNextInv_Click()
Range("InvNoLast").Value = Left(Range("InvNoLast").Value, 2) & _
Format(Right(Range("InvNoLast").Value, _
Len(Range("InvNoLast").Value) - 2) + 1, "000000")
End Sub


--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Greeting,

I tried this in the misc group, but I think that was the wrong group,
so here goes, again....

I have an invoice that uses a button to advance the invoice number by
1. When I wrote it the numbers were just numbers, but since then a
letter has been added to the front of the number (was 17445 now
D-017445). My advancing code no longer works and I don't know why!

Here is the code:

Private Sub GetNextInv_Click()
Range("InvNoLast").Value = Range("InvNoLast").Value + 1
End Sub

Anyone have an idea on how to fix it?

Any help would be most appreciated.

TIA

-Minitman