|
-
Dec 20th, 2005, 11:58 PM
#1
Thread Starter
Member
Convert Number into a column heading
Hi all,
I request the help of the excel Gods. I've created a worksheet that does what i want to do but i'm not sure how to create a custom function using VBA to do the same thing. Any help pointers would be greatly appericated.
What i want to achieve is a function that when you pass a number it converts that number into a column heading and returns a string. eg. 5 = E, 66 = BN
Thanks for any help.
-
Dec 21st, 2005, 03:32 AM
#2
Lively Member
Re: Convert Number into a column heading
VB Code:
Debug.Print Split(Cells(, 66).Address, "$")(1)
Pieter
-
Dec 21st, 2005, 05:16 PM
#3
Thread Starter
Member
Re: Convert Number into a column heading
How do i use that line of code i'm confused.
-
Dec 22nd, 2005, 03:52 AM
#4
Lively Member
Re: Convert Number into a column heading
You could use it in the following way:
VB Code:
Dim Number As Integer
Number = InputBox("Enter Number:")
MsgBox "The column name = " & Split(Cells(, Number).Address, "$")(1)
If your Number = 52 then
Cells(,Number).Address would return $AZ$1
The Split function splits $AZ$1 into two parts 1: 'AZ' 2: '1'
Split(,)(1) means you get the first part of the split function: the string 'AZ'.
Hope it helps.
Pieter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|