Hey guys,
This is my first time on the forum. I'm 21 and I'm just starting to get into VBA macro's. Any help would be greatly appreciated as I'm somewhat of a beginner.
I'm designing a program that allows the user to input information, and then via the Worksheets("").application function the user's info is pasted into cells, and what I want is to continue writing my code to take these inputs and multiply different cells from different sheets, to ultimately spit out one integer/double in another cell. Confusing huh!
So what I want my code to do, is automatically take those inputs and multiply it by a number of factors (stats) that I have in the worksheets, to produce a final number (and that's where I'm stuck).
The code I have so far should tell the story a little bit better:
*************************************************
Sub Macro()
'Declare Variables
Dim Name As String
Dim FactorA As String
Dim FactorB As String
Dim Age As Integer
'User inputs
Name = Application.InputBox("What is your name?")
FactorA = Application.InputBox("What is the name of the factor? i.e. DOCTOR")
FactorB = Application.InputBox("What is the name of the second factor you want? i.e. SCIENTIST")
Age = Application.InputBox("What is your age?")
MsgBox ("Thank You! Calculating your numbers!")
'Results are than transferred to a worksheet via the next function (**Results is just one of 5 different sheets I have with data, this is where I want the final result shown)
Worksheets("Results").Cells(2, 1) = Name
Worksheets("Results").Cells(2,2) = FactorA
Worksheets("Results").Cells(2,3) = FactorB
Worksheets("Results").Cells(2,4) = Age
**********************************************************************
...so that is what I have so far. Age is an integer (or double possibly, I might get exact..). And Factor A and Factor B are strings. Now this is where it gets a little confusing so please try to follow: in my excel sheets I have hundreds of stats with words like DOCTOR, SCIENTIST, and STUDENT = > and they all have stats associated with them...so like in my excel sheets, there's hundreds of these occupations (words) in column A, and in column B, C, D, etc. there are numbers. I need my code to multiply the number beside the word they put in. And what I ultimately want is one last result given..and I'd assume it would be something like this: Worksheets("Results").Cells(2,5) = FINALRESULT ---> FINALRESULT being some number which either multiplies/divides, etc Factor A by Factor B by there Age, and then it spits it out in that FinalResult...I might sound like an idiot here so if I need to clarify let me know!!!
Thanks guys! Any help is greatly appreciated!!!
David :-)
Bookmarks