• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Custom cell format in textbox

Villalobos

Active Member
Hello,

I would like to ask that how is it possible to display a custom cell format in textbox on userform?
I have attached the sample file.

Thanks in advance the response!
 

Attachments

If you are referring to a value already in a cell then the easiest is to format the cell as desired and then pull the value into the control using the range Text property.

E.g:
Code:
Private Sub UserForm_Initialize()
    Me.TextBox1.Value = Munka1.Range("B8").Text
End Sub
 
Remove Textbox1 ControlSource from the properties and then use this code in your userform class:

Code:
Option Explicit

Private Sub UserForm_Initialize()
    Me.TextBox1.Value = Munka1.Range("B8").Text
End Sub

Private Sub CommandButton1_Click()
    With Munka1.Range("B8")
        If IsNumeric(.Value) Then
            .Value = .Value + 1
            Me.TextBox1.Value = .Text
        End If
    End With
End Sub
 
Back
Top