#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Textbox Formatting

I have a userform with a textbox where the user needs to enter a number. When
the form is submitted that data goes to a specific cell in a worksheet. But
the number goes into the cell as text. How do I get it to go into the cell as
a number. I have tried to format the cell in the worksheet but it changes
back to text everytime. Thanks in advance for any help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Textbox Formatting

try one of these in your code Im not sure were to tell you to put it without
seeing your code. but this should work for you
Columns("A:A").Select
Selection.NumberFormat = "0.00"

ActiveCell.Select
Selection.NumberFormat = "0.00"

"jmc8355" wrote:

I have a userform with a textbox where the user needs to enter a number. When
the form is submitted that data goes to a specific cell in a worksheet. But
the number goes into the cell as text. How do I get it to go into the cell as
a number. I have tried to format the cell in the worksheet but it changes
back to text everytime. Thanks in advance for any help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Textbox Formatting

Thanks Mike for the help. Unfortunatley I am just learning this stuff. I
pasted my code below for you to look at if you want to. The problem text
boxes are txtMan_Hours.Value = ""
txtMach_Hours.Value = ""

On the form I enter the hours (i.e. 8 or 10) and on the work sheet
"Manufaturing_Time_Data" columns H and I are populated by 8 or 10 but they
are text instead of numbers.

Thanks again


Private Sub cmdClear_Click()

Call UserForm_Initialize

End Sub
__________________________________________________ _____
Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("Manufacturing_Time_Data").A ctivate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 1) = cboName
ActiveCell.Offset(0, 2) = cboDepartment
ActiveCell.Offset(0, 3) = cboEmplyType
ActiveCell.Offset(0, 4) = cboCatagory
ActiveCell.Offset(0, 5) = txtProject_PID
ActiveCell.Offset(0, 6) = txtActivity_Sequence
ActiveCell.Offset(0, 7) = txtMan_Hours
ActiveCell.Offset(0, 8) = txtMach_Hours
If chkIs_Sequence_Complete = True Then
ActiveCell.Offset(0, 9) = "Yes"
Else
ActiveCell.Offset(0, 9) = "No"
End If
ActiveWorkbook.Save
ActiveWorkbook.Sheets("Console").Activate
Unload Me
End Sub
__________________________________________
Private Sub UserForm_Initialize()
With cboName
.AddItem "Alvarez, Cesar"
.AddItem "Boyd, Wallace"
.AddItem "Cardenas, Eustorgio"
.AddItem "Carranza, Ricardo"
End With
cboName.Value = ""
With cboDepartment
.AddItem "1423"
.AddItem "1424"
.AddItem "1425"
End With
cboDepartment.Value = ""
With cboEmplyType
.AddItem "FULL"
.AddItem "TEMP"
End With
cboEmplyType.Value = ""
txtProject_PID.Value = ""
txtActivity_Sequence.Value = ""
txtMan_Hours.Value = ""
txtMach_Hours.Value = ""
With cboCatagory
.AddItem "REGPY"
.AddItem "OVT"
.AddItem "NSREG"
.AddItem "OFFSH"
.AddItem "NSOT"
.AddItem "SICK"
.AddItem "VAC"
.AddItem "HLDY"
End With
cboCatagory.Value = ""
chkIs_Sequence_Complete = False
txtDate.Value = ""
txtDate.SetFocus

End Sub


"Mike" wrote:

try one of these in your code Im not sure were to tell you to put it without
seeing your code. but this should work for you
Columns("A:A").Select
Selection.NumberFormat = "0.00"

ActiveCell.Select
Selection.NumberFormat = "0.00"

"jmc8355" wrote:

I have a userform with a textbox where the user needs to enter a number. When
the form is submitted that data goes to a specific cell in a worksheet. But
the number goes into the cell as text. How do I get it to go into the cell as
a number. I have tried to format the cell in the worksheet but it changes
back to text everytime. Thanks in advance for any help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Textbox Formatting

try this
Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("Manufacturing_Time_Data").A ctivate
Columns("H:I").Select
Selection.NumberFormat = "0.00"
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 1) = cboName
ActiveCell.Offset(0, 2) = cboDepartment
ActiveCell.Offset(0, 3) = cboEmplyType
ActiveCell.Offset(0, 4) = cboCatagory
ActiveCell.Offset(0, 5) = txtProject_PID
ActiveCell.Offset(0, 6) = txtActivity_Sequence
ActiveCell.Offset(0, 7) = txtMan_Hours
ActiveCell.Offset(0, 8) = txtMach_Hours
If chkIs_Sequence_Complete = True Then
ActiveCell.Offset(0, 9) = "Yes"
Else
ActiveCell.Offset(0, 9) = "No"
End If
ActiveWorkbook.Save
ActiveWorkbook.Sheets("Console").Activate
Unload Me
End Sub
__________________________________________
Private Sub UserForm_Initialize()
With cboName
.AddItem "Alvarez, Cesar"
.AddItem "Boyd, Wallace"
.AddItem "Cardenas, Eustorgio"
.AddItem "Carranza, Ricardo"
End With
cboName.Value = ""
With cboDepartment
.AddItem "1423"
.AddItem "1424"
.AddItem "1425"
End With
cboDepartment.Value = ""
With cboEmplyType
.AddItem "FULL"
.AddItem "TEMP"
End With
cboEmplyType.Value = ""
txtProject_PID.Value = ""
txtActivity_Sequence.Value = ""
txtMan_Hours.Value = ""
txtMach_Hours.Value = ""
With cboCatagory
.AddItem "REGPY"
.AddItem "OVT"
.AddItem "NSREG"
.AddItem "OFFSH"
.AddItem "NSOT"
.AddItem "SICK"
.AddItem "VAC"
.AddItem "HLDY"
End With
cboCatagory.Value = ""
chkIs_Sequence_Complete = False
txtDate.Value = ""
txtDate.SetFocus

End Sub

"jmc8355" wrote:

Thanks Mike for the help. Unfortunatley I am just learning this stuff. I
pasted my code below for you to look at if you want to. The problem text
boxes are txtMan_Hours.Value = ""
txtMach_Hours.Value = ""

On the form I enter the hours (i.e. 8 or 10) and on the work sheet
"Manufaturing_Time_Data" columns H and I are populated by 8 or 10 but they
are text instead of numbers.

Thanks again


Private Sub cmdClear_Click()

Call UserForm_Initialize

End Sub
__________________________________________________ _____
Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("Manufacturing_Time_Data").A ctivate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 1) = cboName
ActiveCell.Offset(0, 2) = cboDepartment
ActiveCell.Offset(0, 3) = cboEmplyType
ActiveCell.Offset(0, 4) = cboCatagory
ActiveCell.Offset(0, 5) = txtProject_PID
ActiveCell.Offset(0, 6) = txtActivity_Sequence
ActiveCell.Offset(0, 7) = txtMan_Hours
ActiveCell.Offset(0, 8) = txtMach_Hours
If chkIs_Sequence_Complete = True Then
ActiveCell.Offset(0, 9) = "Yes"
Else
ActiveCell.Offset(0, 9) = "No"
End If
ActiveWorkbook.Save
ActiveWorkbook.Sheets("Console").Activate
Unload Me
End Sub
__________________________________________
Private Sub UserForm_Initialize()
With cboName
.AddItem "Alvarez, Cesar"
.AddItem "Boyd, Wallace"
.AddItem "Cardenas, Eustorgio"
.AddItem "Carranza, Ricardo"
End With
cboName.Value = ""
With cboDepartment
.AddItem "1423"
.AddItem "1424"
.AddItem "1425"
End With
cboDepartment.Value = ""
With cboEmplyType
.AddItem "FULL"
.AddItem "TEMP"
End With
cboEmplyType.Value = ""
txtProject_PID.Value = ""
txtActivity_Sequence.Value = ""
txtMan_Hours.Value = ""
txtMach_Hours.Value = ""
With cboCatagory
.AddItem "REGPY"
.AddItem "OVT"
.AddItem "NSREG"
.AddItem "OFFSH"
.AddItem "NSOT"
.AddItem "SICK"
.AddItem "VAC"
.AddItem "HLDY"
End With
cboCatagory.Value = ""
chkIs_Sequence_Complete = False
txtDate.Value = ""
txtDate.SetFocus

End Sub


"Mike" wrote:

try one of these in your code Im not sure were to tell you to put it without
seeing your code. but this should work for you
Columns("A:A").Select
Selection.NumberFormat = "0.00"

ActiveCell.Select
Selection.NumberFormat = "0.00"

"jmc8355" wrote:

I have a userform with a textbox where the user needs to enter a number. When
the form is submitted that data goes to a specific cell in a worksheet. But
the number goes into the cell as text. How do I get it to go into the cell as
a number. I have tried to format the cell in the worksheet but it changes
back to text everytime. Thanks in advance for any help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox to Textbox Troubled User Excel Discussion (Misc queries) 1 April 13th 07 03:44 AM
textbox formatting jnf40 Excel Discussion (Misc queries) 1 August 3rd 06 08:12 PM
textbox enyaw Excel Discussion (Misc queries) 1 May 11th 06 02:42 PM
TextBox Formatting grahammal Excel Discussion (Misc queries) 3 April 12th 06 04:54 PM
Help needed with textbox formatting in Excel 2000 JIMBROOKS Excel Discussion (Misc queries) 1 January 1st 05 03:33 PM


All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"