Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Friends!
I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Cells(1,1)
"FARAZ QURESHI" wrote: Hi Friends! I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Function Part(rng As Range, x)
Part = rng(x).Address End Function in ur sheet type : =Part(A1:A4,1) returns A1 =Part(A1:A4,2) returns A2 =Part(A1:B4,1) returns A1 =Part(A1:B4,2) returns B1 and so on "FARAZ QURESHI" skrev: Hi Friends! I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanx brother,
But I want to generate Column(Part). I presume Part in this case is being reflected as a String! How can I have the result of =Column(Part(A1:G1,1)) be reflected as "1"? Thanx again! "excelent" wrote: Function Part(rng As Range, x) Part = rng(x).Address End Function in ur sheet type : =Part(A1:A4,1) returns A1 =Part(A1:A4,2) returns A2 =Part(A1:B4,1) returns A1 =Part(A1:B4,2) returns B1 and so on "FARAZ QURESHI" skrev: Hi Friends! I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Returns as number:
=COLUMN(B1:G4) Returns as text: =TEXT(COLUMN(B1:G4),0) if u mean vba function : Function Part(rng As Range, x) Part = rng(x).Column End Function "FARAZ QURESHI" skrev: Thanx brother, But I want to generate Column(Part). I presume Part in this case is being reflected as a String! How can I have the result of =Column(Part(A1:G1,1)) be reflected as "1"? Thanx again! "excelent" wrote: Function Part(rng As Range, x) Part = rng(x).Address End Function in ur sheet type : =Part(A1:A4,1) returns A1 =Part(A1:A4,2) returns A2 =Part(A1:B4,1) returns A1 =Part(A1:B4,2) returns B1 and so on "FARAZ QURESHI" skrev: Hi Friends! I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub Tester()
Set MyRng = Range("A1:G1") MsgBox "My first cell value is " & MyRng(1) End Sub HTH, Jim "FARAZ QURESHI" wrote: Hi Friends! I am trying to write down my very first custom function code. The function already requires the user to insert a range. Now, I also need to use the very first cell of the range inserted so. For example, the user inserts a range like: A1:G1 or A1:A6 I want to use the range as well as the very first cell, i.e. A1 in this case. How can I refer to the very first one? I have also tried the COLUMN(A1:G1) but its giving me an error in computation. All help and expertise shall be highly obliged. Best Regards, FARAZ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula referring to a dynamic range in a different workbook | Excel Worksheet Functions | |||
Sum values referring to a cell with same value | Excel Discussion (Misc queries) | |||
Sumif referring to range names formulas not updating | Excel Worksheet Functions | |||
How do I use indirect when referring to a named range in a closed | Excel Worksheet Functions | |||
How to return a value Referring to the other cell. | Excel Worksheet Functions |