Q. Autofill question: Can I autofill alpha characters like I can numbers?

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hi,


I want to be able to fille alpha characters in a cell.
I can easily auto-fill numbers, but is it possible to auto-fille
letters? If so, what do i need to do?

Thanks,
George
 
Hopefully, this should help!

From what I know, this can't be done from the frontend worksheets bu
you can do it programmatically using VBA. Have a look at this :-

Sub test()
Dim cnt As Integer, tempval As Integer, final As Integer
cnt = 1
final = 26
tempval = 65 'for upper case A
Do While cnt <= final
Cells(cnt, 1).Value = Chr(tempval)
tempval = tempval + 1
cnt = cnt + 1
Loop
End Sub

The output is letters A through to Z in the first column in rows
through to row 26.


Best regards


Deepak Agarwa
 
Hopefully, this should help!

From what I know, this can't be done from the frontend worksheets but
you can do it programmatically using VBA. Have a look at this :-

Sub test()
Dim cnt As Integer, tempval As Integer, final As Integer
cnt = 1
final = 26
tempval = 65 'for upper case A
Do While cnt <= final
Cells(cnt, 1).Value = Chr(tempval)
tempval = tempval + 1
cnt = cnt + 1
Loop
End Sub

The output is letters A through to Z in the first column in rows 1
through to row 26.


Can you please give me a little more insight?
I put the code in the VBA editor, but exactly where, I'm not sure.

TIA
George
 
Can you please give me a little more insight?
I put the code in the VBA editor, but exactly where, I'm not sure.

TIA
George

Also, I forgot to ask, this will continue to

AA, AB, AC, AD and so on, after it reaches the first Z, correct?
 
Tools | Options
then go to the Custom Lists tab.
in the blank white box to the right, put in the letter of the alphabe
(or whatever you're wanting to fill) seperated with commas. then clic
Add.
Doesn't really save any time if you are only wanting to do this aut
fill once though
 
You can write this code in a module sheet in VBA. If you cannot see a
module sheet, then insert one by going to Insert -> Module.

Also, after Z it will not proceed to AA because the ACSII code for A i
65 and increases by 1 for each letter i.e 66 for B and so on. If yo
want it to go to AA then repeat the same code in a loop once i
reached Z.

Let me know how you went. If you continue to have problems, I shal
write the code for you next time but I would rather have you have a g
at this first.


Best regards


Deepak Agarwa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top