Hi.
Wondering if there is a simpler shorter way to do the following: in a userform that has text boxes where numbers are entered and then copied onto an excel sheet via a command button, if the number format in the textbox has no decimal points then when the command button is clicked the destination cell should be formatted to hold no decimal points, if there are decimal points then as many as there are that's how many should be formatted on that cell. i only need up to 6 decimal points.
Here is a code that i wrote (WHICH DOESN'T WORK!) to give you the basic idea.
        If TextBox = Format(Val(.Text), "#%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0"
        End If

        If TextBox = Format(Val(.Text), "#.#%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.0"
        End If

        If TextBox = Format(Val(.Text), "#.##%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.00"
        End If

        If TextBox = Format(Val(.Text), "#.###%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.000"
        End If

        If TextBox = Format(Val(.Text), "#.####%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.0000"
        End If

        If TextBox = Format(Val(.Text), "#.#####%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.00000"
        End If

        If TextBox = Format(Val(.Text), "#.######%") Then
            ActiveCell.Offset(0, 6).NumberFormat = "0.000000"
        End If
Thanks in advance