List alpha numeric numbers between two references

sedwardson

New Member
Joined
Mar 2, 2023
Messages
35
Office Version
  1. 365
Platform
  1. Windows
I found this by Snakehips and it was VERY helpful ! I tried to modify it but found that it only works with numeric entries and not alpha numeric entries.

Rich (BB code):
VBA Code:
Sub Fill()    [A4] = [A1].Value
    ato = [B1].Value
    [B4] = [A2].Value
    bto = [B2].Value
    [C4] = [A3].Value
    cto = [B3].Value
    [A4].DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=ato
    [B4].DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=bto
[C4].DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=cto
End Sub

The code I wrote (but failed to get to work) was:

VBA Code:
Sub Fill()    
    [B3] = [B4].Value
    bto = [C3].Value
    [B4].DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=bto
End Sub


This works with numbers but not for the range I have which is: 531PZ228173 - 531PZ228222

Can anyone help with how I might get the range to work with this cell entry. Thanks.
P.S. Sorry if I've missed some detail out or you require more from me. This is my first post ! Please bear with me :-)
 
Please find the sample file. I hope it will make things more clear:
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Thanks so much for this. I will have some more ranges where I wont know (or there will be a larger amount in the range) is there a way of expanding the range until it gets to an ending number?
 
Upvote 0
I have to see the sample data.
These will be the ranges I am looking to expand out:
1677763137719.png


Thanks
 
Upvote 0
Oh I got it! But I have to insert 48 new rows between B4 and B5. Is this what you want?
 
Upvote 0
I assume you can use this code:
VBA Code:
Sub test()
  Dim lRow As Long, r As Long
  lRow = Cells(Rows.Count, 2).End(xlUp).Row
  Application.ScreenUpdating = False
  For i = lRow To 4 Step -1
    r = Right(Cells(i, 3).Value, 6) - Right(Cells(i, 2).Value, 6)
    Rows(i + 1).Resize(r).EntireRow.Insert
    With Range("B" & i)
    .AutoFill Destination:=.Resize(r + 1)
    End With
  Next
  Application.ScreenUpdating = True
End Sub
But you have large gaps between your numbers. Excel may not have as many rows as you need.
 
Upvote 0
Solution
The numbers are premium bond allocation numbers. I want to expand the ranges so I can see who has won when the draw takes place. For example, if number 528CY422556 is drawn (or a number in the range
528CY422556 - 528CY422605
) I will know who has won. Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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