jaumefp

New Member
Joined
Dec 28, 2017
Messages
1


<ytd-expander id="expander" class="style-scope ytd-comment-renderer" collapsed="" style="display: block; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 10px; --ytd-expander-collapsed-height:80px;"><yt-formatted-string id="content-text" slot="content" split-lines="" tabindex="0" class="style-scope ytd-comment-renderer" style="white-space: pre-wrap; --yt-endpoint-color:hsl(206.1, 79.3%, 52.7%); color: var(--ytd-comment-text-color); font-size: 1.4rem; line-height: 2rem;">How can I do on last 3 characters auto increment alphabetics except vowels.First data=0000BBB to 9999BBB and then a new loop from 0000BBC to 9999BBC... BBD...until data is 9999BBZ i would new loop from 0000BCB-9999BCZ and then new data is 0000BDB...? I would The loop until 9999ZZZ

Thanks!
</yt-formatted-string>
</ytd-expander>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi & welcome to the board
Trying to do all that in one go will probably cause xl to crash, as you are going to be dealing with approx 92 million values.
This will do the numbers & the last 2 letters.
Code:
Sub IncrementAlphaNumeric()

   Dim Rw As Long
   Dim Col As Long
   Dim Cnt As Long
   Dim CntA As Long, CntN1 As Long, CntN2 As Long, CntN3 As Long
   Dim Ch3 As String, Ch2 As String, Ch1 As String
   Dim LetAry(1 To 21) As Variant
   Dim OutAry(1 To 9999, 1 To 441) As Variant
   
Application.ScreenUpdating = False
   For CntN1 = 66 To 90
      Select Case CntN1
         Case 69, 73, 79, 85
         Case Else
         Cnt = Cnt + 1
         LetAry(Cnt) = Chr(CntN1)
      End Select
   Next CntN1
   
   Ch1 = InputBox("please enter starting letter (like B)")
   For CntN2 = 1 To 21
      Ch2 = LetAry(CntN2)
      For CntN3 = 1 To 21
         Ch3 = LetAry(CntN3)
         Rw = 0
         Col = Col + 1
         For CntA = 1 To 9999
            Rw = Rw + 1
            OutAry(Rw, Col) = Format(CntA, "0000") & Ch1 & Ch2 & Ch3
         Next CntA
      Next CntN3
   Next CntN2
   Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).Resize(9999, 441).Value = OutAry
End Sub
When you run this, it will ask for a starting letter. So the 1st time you run it enter B, the 2nd time enter C & so on.
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

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