# List numbers between two numbers



## anndrey2003 (Jan 4, 2023)

Hello.  I want to display the list between two written numbers.  In the example below, the numbers between 2 and 31 or 6 and 15 should appear. In the left part, I should enter the two numbers and in the left, the numbers should be displayed.  Thank you!!


----------



## mohadin (Jan 4, 2023)

Hi
And welcome  into here
Try

```
Sub test()
Dim a, b: Dim i&
a = Range(Cells(3, 1), Cells(3, 2).End(xlDown))
For i = 1 To UBound(a)
    b = Evaluate("row(" & a(i, 1) & ":" & a(i, 2) & ")")
    Cells(2 + i, 4).Offset(, a(i, 1) - 1).Resize(, UBound(b)) = Application.Transpose(b)
Next
End Sub
```


----------



## Peter_SSs (Jan 4, 2023)

Welcome to the MrExcel board!

Possibly this?

23 01 04.xlsmABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH11234567891011121314151617181920212223242526272829303123231 23456789101112131415161718192021222324252627282930314615     6789101112131415                5                               BetweenCell FormulasRangeFormulaD3:AH5D3=IF(AND(D$1>=$A3,D$1<=$B3),D$1,"")


----------



## anndrey2003 (Jan 4, 2023)

mohadin said:


> Hi
> And welcome  into here
> Try
> 
> ...


Thank you.

Type mismatch ...error in VBA

Type


----------



## anndrey2003 (Jan 4, 2023)

Peter_SSs said:


> Welcome to the MrExcel board!
> 
> Possibly this?
> 
> 23 01 04.xlsmABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH11234567891011121314151617181920212223242526272829303123231 23456789101112131415161718192021222324252627282930314615     6789101112131415                5                               BetweenCell FormulasRangeFormulaD3:AH5D3=IF(AND(D$1>=$A3,D$1<=$B3),D$1,"")


Thank you !!!


----------



## Peter_SSs (Jan 4, 2023)

anndrey2003 said:


> Thank you !!!


You're welcome. Thanks for the follow-up.


----------



## anndrey2003 (Jan 4, 2023)

thank you for your help.  If you can help me with the following problem.  I want to transcribe my numbers from the first table in the second next to the yellow number.  
thank you.


----------



## Peter_SSs (Jan 4, 2023)

For the future: MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Try this (I have hidden some columns just to make the mini sheet smaller)

23 01 04.xlsmABCDEFGHIJKAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBL112345678910311234567891011121314151617181920212223242526272829303121231012131822123      10 1213    18   22         3                               48       8                       5222324                     222324       TransferCell FormulasRangeFormulaAH2:BL5AH2=IF(COUNTIF($B2:$AF2,AH$1),AH$1,"")


----------



## anndrey2003 (Jan 4, 2023)

Peter_SSs said:


> For the future: MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
> 
> Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
> 
> ...


Thank you 😊


----------



## Peter_SSs (Jan 4, 2023)

You're welcome. Thanks for the follow-up.


----------

