• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need Major help

Gautam

New Member
Hey Chandoo,


I have created two drop-down boxes, both contains the list of alphabets from A to Z. Also, I have created a button "letters" [button name], now what I want if I select an alphabet from first drop-down box suppose alphabet "A" and alphabet "D" from second drop-down box and click on button "letters", it displays the list of characters/ alphabets from A-D should be like that A-->B-->C-->D

If that is possible, then please let me know how could I do that.


Thanks/ Regards

Gautam Sehdev
 
Guatam


This simple UDF will do this for you


To use

=MakeAlphaString(Rng1, Rng2, [Joiner])

Rng1 First Character or cell

Rng2 Second Character or cell

Joiner a joining string - Default is ""

If

A1 = A

A2 = B


eg:

=MakeAlphaString(A1, A2 )

ABCD


=MakeAlphaString(A1, A2, "--->" )

A-->B-->C-->D

[pre]
Code:
Function MakeAlphaString(Rng1 As Variant, Rng2 As Variant, Optional Jn As Variant = "") As Variant
Dim Tmp As Variant
Alphabet = ""
If Rng1 > Rng2 Then
Tmp = Rng2
Rng2 = Rng1
Rng1 = Tmp
End If

For i = 65 To 90
If Asc(Rng1) <= i And Asc(Rng2) >= i Then MakeAlphaString = MakeAlphaString + Chr(i) + Jn
Next
MakeAlphaString = Left(MakeAlphaString, Len(MakeAlphaString) - Len(Jn))
End Function
[/pre]
 
You could use mid(...) and Find(...)

firstly define name or use this in cell

="A-->B-->C-->D-->E-->F-->G-->H-->I-->J-->K-->L-->M-->N-->O-->P-->Q-->R-->S-->T-->U-->V-->W-->X-->Y-->Z"


then:

=MID(string,FIND(ListValue1,string,1),FIND(ListValue2,string,1)-FIND(ListValue1 ,string,1)+1)
 
Back
Top