由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - a vba question. please help
相关主题
How to use the online code source? ---- A general questionWhat is 'relative computing'?
你们觉得computer sicence最核心的是哪几门课?which school in MA has good evolutionary computation program ?
重新问个小白问题。question about const reference
In memory computing technology问个土问题:什么是satellite data?
Cost of a good computerHow to tell if two computers are accurately synchronized?
Java opportunityAbout timeout in Socket Programming.
请教一下:Javascript callback not working问一个题,1 billion string如何处理 (转载)
Design pattern reflecting context changeA very dump c++ question
相关话题的讨论汇总
话题: vba话题: function话题: row话题: idx话题: name
进入Programming版参与讨论
1 (共1页)
i**a
发帖数: 11
1
I want to wrote a vba function, which returns the name of a user defined
variable. However, my code seems never work. Could someone please look into
my code and point me out? thank you so much.
Function test(s As String)
Dim a(5) As Integer
For idx = 1 To 5
a(idx) = idx
Next idx
ActiveWorkbook.Names.Add Name:=s, RefersTo:=a
test= s
End Function
c**t
发帖数: 2744
2

into
Don't understand your code; to list all names:
Sub ListAllNames()
Row = 1
For Each n In ActiveWorkbook.Names
Cells(Row, 1) = n.Name
Cells(Row, 2) = " " & n.RefersTo
Row = Row + 1
Next n
End Sub

【在 i**a 的大作中提到】
: I want to wrote a vba function, which returns the name of a user defined
: variable. However, my code seems never work. Could someone please look into
: my code and point me out? thank you so much.
: Function test(s As String)
: Dim a(5) As Integer
: For idx = 1 To 5
: a(idx) = idx
: Next idx
: ActiveWorkbook.Names.Add Name:=s, RefersTo:=a
: test= s

i**a
发帖数: 11
3
The function compute a array "a". Instead of returning the array itself to
spreadsheet, I want to return a name, "s", for this array.

into

【在 i**a 的大作中提到】
: I want to wrote a vba function, which returns the name of a user defined
: variable. However, my code seems never work. Could someone please look into
: my code and point me out? thank you so much.
: Function test(s As String)
: Dim a(5) As Integer
: For idx = 1 To 5
: a(idx) = idx
: Next idx
: ActiveWorkbook.Names.Add Name:=s, RefersTo:=a
: test= s

c**t
发帖数: 2744
4
can I rephrase your requirment as "define a function to compute a named rang
e"?
Name should be the collection of cells or objects. I don't think you can def
ine the computed array (scalar) with a name.

【在 i**a 的大作中提到】
: The function compute a array "a". Instead of returning the array itself to
: spreadsheet, I want to return a name, "s", for this array.
:
: into

1 (共1页)
进入Programming版参与讨论
相关主题
A very dump c++ questionCost of a good computer
问个double和long double的问题Java opportunity
computer graphics/vision 领域用哪种语言最多?请教一下:Javascript callback not working
怎么产生全排列?Design pattern reflecting context change
How to use the online code source? ---- A general questionWhat is 'relative computing'?
你们觉得computer sicence最核心的是哪几门课?which school in MA has good evolutionary computation program ?
重新问个小白问题。question about const reference
In memory computing technology问个土问题:什么是satellite data?
相关话题的讨论汇总
话题: vba话题: function话题: row话题: idx话题: name