+ Reply to Thread
Results 1 to 3 of 3

how to add input box for value to be used in formula

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    618

    how to add input box for value to be used in formula

    I have a macro that generates several things but sometimes my Number I need to use in a particular formula needs to be changed. How can I use a pop up that when the macro runs and gets to that formula it asks what correcting factor does it want to use inside the formula and then once the user inputs that value and hits enter the macro continues on"

    sample Code1:
    [code]
    Sub CORRAzm()

    Range("u3:u" & Selection.SpecialCells(xlCellTypeLastCell).Row).FormulaR1C1 = "=RC[-1]+8.1"
    Range("u1").FormulaR1C1 = "Corr. Azm"
    Columns("u:u").NumberFormat = "0.00"
    Columns("u:u").Select
    With Selection.Font
    .Color = -16776961
    .TintAndShade = 0
    End With
    [code]

    The (8.1) sometimes will need to be changed to whatever is the correcting factor.

    Sample code2:
    [code]
    Sub Start()

    Dim lLR As Long
    lLR = Range("C" & Rows.Count).End(xlUp).Row

    Rows("2:2").Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("F2").Select
    Range("F3").Select
    ActiveCell.FormulaR1C1 = "=RC[-1]-0.291666666666667"
    Range("F3").Select
    Selection.AutoFill Destination:=Range("F3:F" & lLR)
    Range("F3:F" & lLR).Select

    Columns("f:f").Select
    With Selection.Font
    .Color = -16776961
    .TintAndShade = 0
    End With
    [code]

    Again the (0.291666666666667) would have to be changed.

    Once I know the process I can duplicate other instances.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: how to add input box for value to be used in formula

    Please Login or Register  to view this content.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: how to add input box for value to be used in formula

    Maybe:

    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 02-24-2013, 06:27 PM
  2. [SOLVED] external link reference formula inside formula user input
    By jscc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2012, 04:29 PM
  3. Replies: 3
    Last Post: 06-02-2012, 07:50 PM
  4. Automatic Formula Input Based on User Input Using a Macro
    By Drayloc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2012, 12:10 PM
  5. input box = formula bar
    By David494 in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 11:05 AM

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