Solved

InputBoxes and Variables

Posted on 2008-10-25
3
198 Views
Last Modified: 2013-11-25
Hi,

I'm using VBA for Excel. I created 2 different variables, vntMonth as a variant and intMonth as an integer. I assigned vntMonth to an inputbox for a user to enter a month. I wanted this to be an integer so i ran it through error-checking using the IsInteger function and If-Else statements. Now I'd like to store this validated version of vntMonth as an integer, therefore using the variable intMonth. How do I do this? What code would I write?
0
Comment
Question by:azmeen123
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 22806092
If you have validated vntMonth already, then:

    Dim vntMonth As String
    Dim intMonth As Integer
    ...
    intMonth = CInt(vntMonth)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now