A Follow up to Userform Formating

G

Guest

Hi,

Thanks for your help in the last post. There is one problem I am having
though. I need to input numbers into an input box in the userform, and I
would like the numbers formatted. I have the input box linked to a cell in
the workspace. But using the code

TextBoxPayments.value = format(Sheets("Input").Range("D8").Value, "$#,##0")
or
TextBoxPayments.value = Sheets("Input").Range("D8").text

Does not allow me to change the value in the input box, it sets the input
box to the value in D8. Is there any way around this so I can input values
that are formatted?

Thanks for your help
 
D

Dave Peterson

I'd drop the linked cell and have the code change the value in the cell:

Option Explicit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If IsNumeric(.Value) Then
Worksheets("Input").Range("D8").Value = .Value
.Value = Format(.Value, "$#,##0")
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top