AlphaNumeric Increment for a particular series not visible in Textbox if combobox value selected

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
688
In column B ther are Numbers from 2nd row to Last row. starting from 0001
in between in column B thereare numbers starting with "Z-" and these also respectively starting from 0001 but if i select in combobox "ABC"
I would like to auto increment the number with String "Z-0002 in the textbox when i select combox value as "ABC"

Code:
Private Sub UserForm_Initialize()
  With worksheets("Sheet1")
       .Columns("B").NumberFormat = "0000"
  End with
End Sub

Public Sub Auto_Increment_No()

Dim Var2 as Variant
Dim alpNum as String
If comboName.Text = "ABC" Then
          alpNum = "Z-" & Format(Var2 + 1, "0000")
          TextNos.Text = alpNum 
[B][COLOR=#ff0000]  '''''Here TextNos.Text showing Blank No increament Value at all[/COLOR][/B]
   Else
          TextNos.Text =  Format(Var2 + 1, "0000")
[B][COLOR=#ff0000]   ''''' Here it shows perfectly without alpNum[/COLOR][/B]
End Sub

Thanks
NimishK
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Yes I got it, Thanks
Code:
Public Sub Auto_Increment_No()

Dim Var2 as Variant
If comboName.Text = "ABC" Then
          TextNos.Text = Left(Var2, 2) & Format(Val(Right(Var2, 4)) + 1, "0000") 
     Else
          TextNos.Text =  Format(Var2 + 1, "0000")
End if
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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