Results 1 to 4 of 4

Thread: Formula Editor/Bar in UserForm TextBox?

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Formula Editor/Bar in UserForm TextBox?

    Hi,

    I have a Userform w/ text boxes who's inputted value populates a certain cell (currently only supports static values).
    Is it possible to have a userform textbox mimic a formula editor/bar so that the imputted values can be formulas that you can either type or click the relevant cells to write?

    Example of the formula editor/bar I'm thinking of -- (basically can i add this to a user form)?:

    formula bar.png

    This way, end users can write a formula and that formula will be the text box's value, which will then populate the predetermined cell -- still as a formula (i.e. the value in the cell that the texbox populates is not static, but a dynamic formula)

    This would help a ton, if possible!
    Let me know if unclear

    Thank you!

  2. #2
    Junior Member
    Join Date
    Feb 2017
    Posts
    2
    Rep Power
    0
    .
    .
    Paste this code in your UserForm for the CommandButton.

    Code:
    Option Explicit
    
    Private Sub CommandButton1_Click()
        Sheets("Sheet1").Range("A3").Formula = TextBox1.Text
    End Sub
    This example presumes two numbers, one in A1 and one in A2 ..... with the total in A3.

    ex: =SUM(A1:A2)

    or

    ex: =A1-A2

    or

    ex: =A1*A2
    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    Quote Originally Posted by Logit View Post
    .
    .
    Paste this code in your UserForm for the CommandButton.

    Code:
    Option Explicit
    
    Private Sub CommandButton1_Click()
        Sheets("Sheet1").Range("A3").Formula = TextBox1.Text
    End Sub
    This example presumes two numbers, one in A1 and one in A2 ..... with the total in A3.

    ex: =SUM(A1:A2)

    or

    ex: =A1-A2

    or

    ex: =A1*A2
    You'd have to type in the formula and cell references for this method. Is it possible to add a formula bar to the UserForm -- so that you can click a cell?

  4. #4
    Junior Member
    Join Date
    Feb 2017
    Posts
    2
    Rep Power
    0
    I don't understand.

Similar Threads

  1. Replies: 8
    Last Post: 08-17-2016, 12:53 PM
  2. Editor Formating Test
    By DocAElstein in forum Test Area
    Replies: 8
    Last Post: 02-02-2016, 06:09 PM
  3. Replies: 10
    Last Post: 10-17-2013, 08:06 PM
  4. VBA editor auto-deletes spaces at the ends of lines
    By LalitPandey87 in forum Excel Help
    Replies: 0
    Last Post: 06-26-2012, 08:23 PM
  5. Hide Ribbon and Formula Bar
    By Excel Fox in forum Excel Tips and Tricks
    Replies: 0
    Last Post: 04-21-2011, 07:33 PM

Posting Permissions

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