How Can I Access a Subprogram on a Separate Screen in Excel?

In summary, to access the subprogram that randomises the money values for the briefcases in the main game screen of the program, one would need to declare a Function in a VB module.
  • #1
TripleS
22
0
I am using the VB script that is already in Excel, and I am making a program similar to that "Deal or No Deal" show that airs in many countries.
The concept of the game is where there is a certain number of briefcases, and there is a money value in each of those. You choose one, and slowly choose other briefcases. The aim is to keep the most money in the unopened briefcases to generate the largest bank offer (where a 'bank' tries to buy your briefcase on the chance of that briefaces to have a certain amount of money)

In the main game screen where one chooses the briefcase I have put in a code the randomises the 18 possible money values for the 18 briefcases. I need that randomisation to occur when Excel is opened up, but the subprogram with the randomisation and intialisation of variables is on a separate screen (which has its own code), which I cannot access from the 'This Workbook' screen.

Does anyone know of a way to bypass this, so i can access the subprogram i need?
 
Technology news on Phys.org
  • #2
Not sure that I completely understand your problem, or what it is you want to do but...

If you declare a Function in a VB module, Excel will use it just as it uses any Excel function. So if I declare

Function XYZ( a as integer, b as double)
.
.
end

I can then write = XYZ(a1, a2) in a cell. Excel will execute the VB function.
 
  • #3
okay...let me try and reiterate
There is a subprogram that randomises the money values for each briefcase
that is in a particular spot (in a 'screen' of Microsoft Excel Objects), and i need that section of code to run when the program is opened up. But if i simply put GameSetup (name of the subprogram), it doesn't know where it is, and if i put the whole code in, it can't find that the objects to which the code is attached to...

hope you got that
 

1. What is Excel programming?

Excel programming refers to the process of writing code in the Visual Basic for Applications (VBA) language to automate tasks and enhance functionality within Microsoft Excel. It allows users to create customized solutions and automate repetitive tasks, making data analysis and management more efficient.

2. What are the benefits of using Excel programming?

Excel programming offers several benefits, including increased efficiency, accuracy, and productivity. It allows for the automation of repetitive tasks, reduces the likelihood of human error, and enables users to work with larger datasets more easily. Additionally, it allows for the customization of Excel to suit individual needs and preferences.

3. Do I need to have coding experience to learn Excel programming?

No, you do not need to have prior coding experience to learn Excel programming. However, having a basic understanding of programming concepts and familiarity with Excel functions can be helpful. There are also many online resources and tutorials available to help beginners learn Excel programming.

4. What are some common applications of Excel programming?

Excel programming can be used for a variety of tasks, such as data analysis, report automation, data visualization, and creating interactive dashboards. It can also be used for financial modeling, project management, and data validation. Essentially, any task that involves manipulating data in Excel can be automated or enhanced using programming.

5. Is Excel programming only useful for large datasets?

No, Excel programming can be useful for datasets of any size. While it can be particularly helpful for handling large datasets, it can also be used for smaller datasets to automate tasks and improve efficiency. Additionally, Excel programming can be used for various other tasks in Excel, such as formatting, data validation, and creating user-friendly interfaces.

Similar threads

  • STEM Academic Advising
Replies
5
Views
924
  • Programming and Computer Science
Replies
4
Views
946
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
3
Views
4K
Replies
9
Views
3K
  • Sticky
  • Aerospace Engineering
2
Replies
48
Views
60K
Replies
1
Views
3K
  • STEM Academic Advising
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
7K
Replies
4
Views
10K
Back
Top