Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Defining variables using a for loop in VBA

Posted on 2006-04-11
Medium Priority
Last Modified: 2010-05-01
How do I code the "NPMax(i)" to get this to work correctly?

For i = 1 To [Forms]![NominalData]!Modes.Value
   NPMax(i) = ([Forms]![NominalData]("p" & i).Value + (3 / 100 * 18))

Question by:rgrguric
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 16428982
dim NPMax() as double

redim NPMax(1 to [Forms]![NominalData]!Modes.Value) as double
For i = 1 To [Forms]![NominalData]!Modes.Value
   NPMax(i) = ([Forms]![NominalData]("p" & i).Value + (3 / 100 * 18))

Author Comment

ID: 16429046
Awesome, thanks!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question