Consulting

Results 1 to 7 of 7

Thread: month

  1. #1

    month

    does any one know how i can convert year to month.
    would it be

    textbox*12

    so if user enters 2 then *12 = 24 months is that correct

    and how would i do the coding for this

  2. #2
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    What is it exactly that you're trying to do? Where are users entering the "2"?

    If possible, please attach a small, sanitised version of your file so that we can see what you're after.

  3. #3
    Quote Originally Posted by geekgirlau
    What is it exactly that you're trying to do? Where are users entering the "2"?

    If possible, please attach a small, sanitised version of your file so that we can see what you're after.
    well a user will enter numbers, which maximum will be up to 30 in a text box.
    how could i make that textbox be equal to a month so examlpe if user enters 2 then that is equal to 24 months etc..

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You mean that you want the textbox he enters 2 into, to change to 24 automatically? If so,
    [VBA]Private Sub TextBox1_AfterUpdate()
    Me.TextBox1 = Me.TextBox1.Value * 12
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    basically there is two textbox.
    textbox one is for user to enter a value and second textbox is for user to enter years.

    and the output would be calculated and output would be done in monthly.

    so 10*2 = 20 / 24months = 0.84

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    And where does the result go?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Haven't we done this before?

    [vba]

    Me.TextBox3.Text = Format(CDbl(TextBox1.Text) * CDbl(TextBox2.Text) / 24, "#,##0.00")
    [/vba]

Posting Permissions

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