Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ATPVBAEN.XLA!Random Call in Macro

Hi,

I am trying to call the Data Analysis Random Number Generator from a Macro.
My range of Values and Probabilities is in Sheet 1 in the range A1:B4 and is
named MyRange.

My macro is:

Sub GenRandomNumbers()

Application.Run "ATPVBAEN.XLA!Random", ActiveSheet.Range("$a$15"), 1,
99, _
7, , ActiveSheet.Range("MyRange")

End Sub

This works fine until I move away from using ActiveSheet. If I try to run
the macro using explicit sheet references, the macro fails as in the
following example:

Sub GenRandomNumbers()

Application.Run "ATPVBAEN.XLA!Random", Sheet2.Range("$a$15"), 1, 99, _
7, , Sheet1.Range("MyRange")

End Sub


I would appreciate any guidance the group can provide. I am also interested
in finding out how I can find the list of arguments for a called function
like this.

Thanks,

Frank Hayes


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ATPVBAEN.XLA!Random Call in Macro

Frank & Pam

Try this amendment

Sub GenRandomNumbers()

Application.Run "ATPVBAEN.XLA!Random", Sheets(2).Range("$a$15"), 1, 99
7, , Sheet(1).Range("MyRange")

End Sub

This assumes that the active workbook will be used.
If you want to reference other than the active workbook you will nee
to further qualify the sheets() reference like thi
workbook.sheets(n).et

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ATPVBAEN.XLA!Random Call in Macro

That worked Kieran. Thank you for the advice.

Frank

"Kieran " wrote in message
...
Frank & Pam

Try this amendment

Sub GenRandomNumbers()

Application.Run "ATPVBAEN.XLA!Random", Sheets(2).Range("$a$15"), 1, 99,
7, , Sheet(1).Range("MyRange")

End Sub

This assumes that the active workbook will be used.
If you want to reference other than the active workbook you will need
to further qualify the sheets() reference like this
workbook.sheets(n).etc


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ATPVBAEN.XLA!Random Call in Macro

Need to get a better newsreader. Problem was solved yesterday.

--
Regards,
Tom Ogilvy

"Jonathan Rynd" wrote in message
. ..
Kieran wrote in
:

Sheets(2)
Sheet(1)


Is it "Sheets" or "Sheet" or do both of them work?

--
My email address has an extra @ (spell it out) and an extra invalid.

Please
remove them if you are not a spammer or list broker and want to reply.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default ATPVBAEN.XLA!Random Call in Macro

"Tom Ogilvy" wrote in news:Oq9ovbZ8DHA.3360
@tk2msftngp13.phx.gbl:

Need to get a better newsreader. Problem was solved yesterday.


I was asking because I wanted to know. I saw that the problem had been
solved.


--
My email address has an extra @ (spell it out) and an extra invalid. Please
remove them if you are not a spammer or list broker and want to reply.
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
How can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Yield() function missing from XL2007 SP1 ATPVBAEN Analysis ToolPak Ron West Excel Worksheet Functions 8 November 14th 08 11:30 AM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
atpvbaen.xla cound not be found MIRA Excel Discussion (Misc queries) 2 July 20th 07 12:46 PM
Atpvbaen.xls FilippoRotolo Excel Worksheet Functions 0 July 14th 06 05:47 PM


All times are GMT +1. The time now is 03:55 AM.

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"