+ Reply to Thread
Results 1 to 3 of 3

VBA Project Help! Occupations!

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Talking VBA Project Help! Occupations!

    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 :-)

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA Project Help! Occupations!

    Hi David Welcome to the forum.

    Have a quick read of the rules: http://www.excelforum.com/forum-rule...rum-rules.html

    In partcular, your thread title is too vague, and you need to use CODE tags when you post code.

    You'll also find it helpful to attach a sample workbook, so we can see how your data is laid out.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Project Help! Occupations!

    Hi, and welcome to the forum. Unfortunately your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    And for good measure the title is somewhat suspect and infringes another rule. Please review the rules on suitable subject titles. We like to see something that succinctly describes your problem.


    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Match date to project in array and calculate days since last project of same name
    By peepingtom in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-22-2013, 12:37 AM
  2. [SOLVED] Function that concatenates multiple sub-project descriptions based on project code
    By markbpi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2012, 06:49 PM
  3. [SOLVED] Insert Blank Rows between sorted projects, Subtotal project to the right of final project.
    By ZAC7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2012, 04:08 AM
  4. If i entered any project code in sheet2 display all data of that project
    By koolguys4u in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-21-2009, 03:09 AM
  5. Replies: 1
    Last Post: 10-18-2005, 11:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1