Search MrExcel

Increment the vaule (number) in a cell based upon a condition

I am trying to create a customized invoice template and I've run into a roadblock. I can't seem to write a macro that will increment the value in my "Invoice #" cell. I want the value to increment each time I press a form button, so I need to assign a macro to the button. I understand how to assign the macro, I just can't write one that will function correctly in both the template version AND the workbook version.

Posted by Joe Was on June 01, 2001 12:48 PM

Tim, Have a starting value in your "Invoice #" cell. Note the cell address. On the Macro page name your macro, I used "Increase_B8" B8 being the cell that has the invoice #.Copy & paste, [B8].Value = [B8] + 1If you have macros already Edit any one and add all the code below with copy & paste. Change the cell address and title. Close macros.

(12 responses) HI! I am using a vlookup/match to populate fields from column headers. For the most part it's doing exactly what I need except instead of pu

Let's Connect

MrExcel.com debuted on November 21, 1998.

MrExcel.com provides examples of Formulas, Functions and Visual Basic procedures
for illustration only, without warranty either expressed or implied, including
but not limited to the implied warranties of merchantability and/or fitness for
a particular purpose. The Formulas, Functions and Visual Basic procedures on this
web site are provided "as is" and we do not guarantee that they can be used in all
situations.
This site contains affiliate links. Any affiliate commissions that we
earn when you click a link to Amazon or other sites is reinvested in keeping MrExcel.com
running. You can earn a commission for sales leads that you send to us by joining our
affiliate program.
View our Privacy Policy, Cookies Policy, and Terms of Use.