Is there a property for a user-form textbox which allows editing of the cell associated with that textbox?
Is there a property for a user-form textbox which allows editing of the cell associated with that textbox?
I am not getting exactly what do you want to do.
Do you want to use the textbox to edit a cell? To format it?
The userform textbox contains text equivalent to that in the cell.
I want to edit the textbox and for edit to show at the cell.
Last edited by Un-Do Re-Do; 12-19-2017 at 09:59 AM.
So I assume you have the value for your TextBox assign on the userform iniciate sub.
Just add the following code to the userform:
cmdAdd is the Command box you have to validate the change on the userformPrivate Sub cmdAdd_Click() Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Cells(A, 1).Value = Me.TextBox1.Value End With End Sub
TextBox1 is your text box
Hi Excel_&_Help,
Try in an Ordinary Code Module:
Try in the UserForm code module:Option Explicit Sub UserFormExample() UserForm1.TextBox1.Value = Range("A3").Value UserForm1.Show False 'Non-Modal - allows access to Excel Resources End Sub
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:Option Explicit Private Sub TextBox1_Change() Range("A3") = TextBox1.Value End Sub
This option requires all variables to be declared and will give a compiler error for undeclared variables.Option Explicit
Lewis
The textbox use a ControlSource property that will directly link cell text to textbox text. It will not take into account mixed font formatting though, which I think is the whole point of what you are trying to do.
Hi Excel_&_Help,
I posted a reply in your other link. I will no longer respond to any posts in this link.
Link to your other post: https://www.excelforum.com/excel-pro...ml#post4805730
I agree with Andy that mixing Font properties are not available in UserForm controls. There is allegedly a lnkEdit control that may do what you want. You are on your own if you want to pursue the lnkEdit control.
Lewis
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks