Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hmm hmm is offline
external usenet poster
 
Posts: 175
Default Use VB array as as argument for worksheet function

I know I can use Excel worksheet functions in VB. My question is when one of
the parameters of a function is an array. Can I used an array defined in VB
code (instead of the usual worksheet-range input) as the argument for this
function? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Use VB array as as argument for worksheet function

Yeah, no problem, such as

Application.SUM(array)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is when one
of
the parameters of a function is an array. Can I used an array defined in
VB
code (instead of the usual worksheet-range input) as the argument for this
function? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Use VB array as as argument for worksheet function

Sub test()

myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:

Yeah, no problem, such as

Application.SUM(array)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is when one
of
the parameters of a function is an array. Can I used an array defined in
VB
code (instead of the usual worksheet-range input) as the argument for this
function? Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Use VB array as as argument for worksheet function

Why do you always reply to someone else's post instead of the original post,
especially when you then just say the same thing?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message
...
Sub test()

myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:

Yeah, no problem, such as

Application.SUM(array)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is when
one
of
the parameters of a function is an array. Can I used an array defined
in
VB
code (instead of the usual worksheet-range input) as the argument for
this
function? Thanks.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Use VB array as as argument for worksheet function

On Dec 9, 9:09 am, "Bob Phillips" wrote:
Why do you always reply to someone else's post instead of the original post,
especially when you then just say the same thing?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message

...

Sub test()


myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:


Yeah, no problem, such as


Application.SUM(array)


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is when
one
of
the parameters of a function is an array. Can I used an array defined
in
VB
code (instead of the usual worksheet-range input) as the argument for
this
function? Thanks.


Before a fence war starts, I've noticed that responses are not posted
immediately. So I'm assuming two guys can submit the same idea before
each has seen the other's posted. Now I also get the feeling that we
have an understated Jeopardy thing going on here in being first to
respond. Maybe if you guys got buzzers....:)

SteveM


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Use VB array as as argument for worksheet function

Bob: First, If I reply to the originator then the replier doesn't see the
response. I think all the responders should see all the responses.

Second, I think you sometimes reply at a level that a Newbie would not
understand. Not everybody knows about the Array function in VB. A newbie
may code the following

Dim myarray(4)
myarray(0) = 1
myarray(1) = 2
myarray(2) = 3
myarraya3) = 4

My code showed how to define an array which your code didn't. It is
difficult by the psting to know the persons skill level. Too many times
people respond that they didn't understand the instructions. The experts
should be teaching the Newbie, not just answer the questions. Code that we
post should should be understandable that anybody including Newbies can
clearly understand. Document the code where necessary. Use intermediate
variable to make the code clear.

Rather than
data = Range("A" & rows.count).end(xlup)
It is better
LastRow = Range("A" & rows.count).end(xlup).row
data = Range("A" & LastRow)

The code may be less efficient, but it is more understandable.


"Bob Phillips" wrote:

Why do you always reply to someone else's post instead of the original post,
especially when you then just say the same thing?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message
...
Sub test()

myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:

Yeah, no problem, such as

Application.SUM(array)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is when
one
of
the parameters of a function is an array. Can I used an array defined
in
VB
code (instead of the usual worksheet-range input) as the argument for
this
function? Thanks.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Use VB array as as argument for worksheet function

On Sun, 9 Dec 2007 06:26:00 -0800, Joel wrote:

Bob: First, If I reply to the originator then the replier doesn't see the
response. I think all the responders should see all the responses.


Why is that?

I've never found that to be a problem. Maybe you need a proper newsreader?
--ron
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Use VB array as as argument for worksheet function

No, he quoted mine, so he must have seen it.

It's nothing to do with jeopardy, but it is wasting my time if I see a
response to my post as I tend to read it.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"SteveM" wrote in message
...
On Dec 9, 9:09 am, "Bob Phillips" wrote:
Why do you always reply to someone else's post instead of the original
post,
especially when you then just say the same thing?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Joel" wrote in message

...

Sub test()r


myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:


Yeah, no problem, such as


Application.SUM(array)


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is
when
one
of
the parameters of a function is an array. Can I used an array
defined
in
VB
code (instead of the usual worksheet-range input) as the argument
for
this
function? Thanks.


Before a fence war starts, I've noticed that responses are not posted
immediately. So I'm assuming two guys can submit the same idea before
each has seen the other's posted. Now I also get the feeling that we
have an understated Jeopardy thing going on here in being first to
respond. Maybe if you guys got buzzers....:)

SteveM



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Use VB array as as argument for worksheet function

Joel,

I have no problem with you joining in if you think you have something to
add, but the guy mentioned an array defined in VB, so it seemed reasonable
to me that he knew what an array is. Notwithstanding that issue, and the
point that you make there may be valid, but perhaps you could take note of
someone like Dave Peterson who, when he jumps in, tends to make the
additional point, and explain that he is making an additional point and what
he thinks is not previously fully explained, rather than just seemingly
repeating the previous post, albeit in more words.

But on the other point, why would the replier not see the response. The
whole thread is there to be read. If I see a response below mine, I tend to
think it pertains to my response and I read it, which means that I waste my
time. And you are the only regular that I know that does that, no-one else
seems to think it valid.


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Joel" wrote in message
...
Bob: First, If I reply to the originator then the replier doesn't see the
response. I think all the responders should see all the responses.

Second, I think you sometimes reply at a level that a Newbie would not
understand. Not everybody knows about the Array function in VB. A newbie
may code the following

Dim myarray(4)
myarray(0) = 1
myarray(1) = 2
myarray(2) = 3
myarraya3) = 4

My code showed how to define an array which your code didn't. It is
difficult by the psting to know the persons skill level. Too many times
people respond that they didn't understand the instructions. The experts
should be teaching the Newbie, not just answer the questions. Code that
we
post should should be understandable that anybody including Newbies can
clearly understand. Document the code where necessary. Use intermediate
variable to make the code clear.

Rather than
data = Range("A" & rows.count).end(xlup)
It is better
LastRow = Range("A" & rows.count).end(xlup).row
data = Range("A" & LastRow)

The code may be less efficient, but it is more understandable.


"Bob Phillips" wrote:

Why do you always reply to someone else's post instead of the original
post,
especially when you then just say the same thing?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Joel" wrote in message
...
Sub test()

myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:

Yeah, no problem, such as

Application.SUM(array)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is
when
one
of
the parameters of a function is an array. Can I used an array
defined
in
VB
code (instead of the usual worksheet-range input) as the argument
for
this
function? Thanks.








  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Use VB array as as argument for worksheet function

On Dec 9, 9:52 am, "Bob Phillips" wrote:
Joel,

I have no problem with you joining in if you think you have something to
add, but the guy mentioned an array defined in VB, so it seemed reasonable
to me that he knew what an array is. Notwithstanding that issue, and the
point that you make there may be valid, but perhaps you could take note of
someone like Dave Peterson who, when he jumps in, tends to make the
additional point, and explain that he is making an additional point and what
he thinks is not previously fully explained, rather than just seemingly
repeating the previous post, albeit in more words.

But on the other point, why would the replier not see the response. The
whole thread is there to be read. If I see a response below mine, I tend to
think it pertains to my response and I read it, which means that I waste my
time. And you are the only regular that I know that does that, no-one else
seems to think it valid.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message

...

Bob: First, If I reply to the originator then the replier doesn't see the
response. I think all the responders should see all the responses.


Second, I think you sometimes reply at a level that a Newbie would not
understand. Not everybody knows about the Array function in VB. A newbie
may code the following


Dim myarray(4)
myarray(0) = 1
myarray(1) = 2
myarray(2) = 3
myarraya3) = 4


My code showed how to define an array which your code didn't. It is
difficult by the psting to know the persons skill level. Too many times
people respond that they didn't understand the instructions. The experts
should be teaching the Newbie, not just answer the questions. Code that
we
post should should be understandable that anybody including Newbies can
clearly understand. Document the code where necessary. Use intermediate
variable to make the code clear.


Rather than
data = Range("A" & rows.count).end(xlup)
It is better
LastRow = Range("A" & rows.count).end(xlup).row
data = Range("A" & LastRow)


The code may be less efficient, but it is more understandable.


"Bob Phillips" wrote:


Why do you always reply to someone else's post instead of the original
post,
especially when you then just say the same thing?


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"Joel" wrote in message
...
Sub test()


myarray = Array(1, 2, 3, 4)
total = WorksheetFunction.Sum(myarray)
End Sub


"Bob Phillips" wrote:


Yeah, no problem, such as


Application.SUM(array)


--
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"hmm" wrote in message
...
I know I can use Excel worksheet functions in VB. My question is
when
one
of
the parameters of a function is an array. Can I used an array
defined
in
VB
code (instead of the usual worksheet-range input) as the argument
for
this
function? Thanks.


Bob, Suggest you ignore any responses submitted by Joel to minimize
time wasted.
Joel, Suggest you consider the rationale of Bob's position, but also
ignore his posts if it suits you.

If that doesn't work, I suggest Marquis of Queensbury Rules and 8
ounce gloves.

SteveM
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA function for "Mean" using Array as argument ASokolik Excel Worksheet Functions 21 March 28th 06 10:05 PM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
Passing an array as argument for custom Function No Name Excel Programming 4 March 7th 05 04:44 PM
Worksheet Name as argument in Custom Function Larry D Excel Programming 1 September 25th 03 08:31 PM
Passing an Array of User-Defined Type to an Argument of a Function Tushar Mehta[_6_] Excel Programming 0 August 17th 03 06:43 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"