How autonumber in textbox on userform based on click three buttons

Omar M

Board Regular
Joined
Jan 11, 2024
Messages
66
Office Version
  1. 2019
Platform
  1. Windows
Hi
I have numbering in cell G12 for each sheet , I have four sheets(DATA,OUTPUT,INPUT,EXTRACTION).
and I have userform contains textbox1 to show autonumbering basd on G12 and combobox1 contains sheets names. also I have commandbutton1,commandbutton2,commandbutton3 .
so when running the userform and select sheet name from combobox1 then will populate sheet name and autonumbering in textbox1 and G12 .
for instance
combobox1= DATA
then textbox1= "DATA INV NO DA 0000001" and G12 will be="DATA INV NO DA 0000001"
so should write INV NO , as to DA should be based on two letters for sheet name from left "DA" and write number "0000001"
when click commandbutton1 then will be in textbox1,G12="DATA INV NO DA 0000002" should increment the invoice number.
if I click commandbutton2 then will decrease invoice number to become from "DATA INV NO DA 0000002" to "DATA INV NO DA 0000001"
but if I click commandbutton3 then should return the original invoice number is existed in G12 without increase or decrease number.
the same thing for any sheet is selected from combobox1 should poulate the sheet name and write INV NO and two letters for the sheet from left and write 0000001
I hope to find help from experts.
thanks
 
@Artik
also your code is Awesome !
as to my request about in post #9
I modified and works perfectly
Rich (BB code):
    Me.TextBox1.Value = Me.Combobox1.Value & " " & InvNo
thank you so much.:)
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top