How autonumber in textbox on userform based on click three buttons

Omar M

Board Regular
Joined
Jan 11, 2024
Messages
55
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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,098
Messages
6,170,099
Members
452,301
Latest member
QualityAssurance

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