Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can run a macro ( call a macro) on selection of any filtercriteria? | Excel Worksheet Functions | |||
Yield() function missing from XL2007 SP1 ATPVBAEN Analysis ToolPak | Excel Worksheet Functions | |||
Call an Access macro from an Excel macro | Excel Discussion (Misc queries) | |||
atpvbaen.xla cound not be found | Excel Discussion (Misc queries) | |||
Atpvbaen.xls | Excel Worksheet Functions |