Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Values don't behave when converting text to values in userform
VBA / Xl 2002
I use a userform to make the user input in a time registration form. The format on the userform form side is .text. When saving this information to a different sheet I try to convert the text to values by changing the suffix from .text to .value. When the values are printed on the sheet, the comma (used as a delimiter in Danish language instead of "." ) has been deleted. Using the following code: Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" and enter the value 1,23456 in the form, I get the output in the following format 123.456 What can I do get the representation right? Thx in advance. Private Sub GemClick_Click() Dim i As Integer Dim dato As Date Worksheets("Timeseddel").Activate Range(Cells(15, 3), Cells(31, 7)).ClearContents Cells(7, 7).ClearContents Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" ActiveWorkbook.Save Cells(15, 3).Activate With ActiveCell If ChkAltDato = True Then ..Offset(-8, 4).Value = TxtAltDato.Text Else: .Offset(-8, 4).Value = txtDato.Text End If .Offset(0, 0).Value = LstNavn1.Text .Offset(0, 1).Value = TxtWkType1.Text .Offset(0, 2).Value = TextRmk1.Text .Offset(0, 3).Value = TextTimeDbt1.Value .Offset(0, 4).Value = TextTimeNonDbt1.Value ..... End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Values don't behave when converting text to values in userform
Have you tried
Offset().Text= instead of Offset().Value= -- Gary's Student gsnu200706 "Kragelund" wrote: VBA / Xl 2002 I use a userform to make the user input in a time registration form. The format on the userform form side is .text. When saving this information to a different sheet I try to convert the text to values by changing the suffix from .text to .value. When the values are printed on the sheet, the comma (used as a delimiter in Danish language instead of "." ) has been deleted. Using the following code: Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" and enter the value 1,23456 in the form, I get the output in the following format 123.456 What can I do get the representation right? Thx in advance. Private Sub GemClick_Click() Dim i As Integer Dim dato As Date Worksheets("Timeseddel").Activate Range(Cells(15, 3), Cells(31, 7)).ClearContents Cells(7, 7).ClearContents Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" ActiveWorkbook.Save Cells(15, 3).Activate With ActiveCell If ChkAltDato = True Then .Offset(-8, 4).Value = TxtAltDato.Text Else: .Offset(-8, 4).Value = txtDato.Text End If .Offset(0, 0).Value = LstNavn1.Text .Offset(0, 1).Value = TxtWkType1.Text .Offset(0, 2).Value = TextRmk1.Text .Offset(0, 3).Value = TextTimeDbt1.Value .Offset(0, 4).Value = TextTimeNonDbt1.Value .... End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Values don't behave when converting text to values in userform
Yes, I did that at first. The result is that the number is formatted as text,
which means that I can sum up the rows in the destination sheet. That was the first problem I was trying to get around by renaming the offset .value instead of .text, but apparently with little succes. "Gary''s Student" skrev: Have you tried Offset().Text= instead of Offset().Value= -- Gary's Student gsnu200706 "Kragelund" wrote: VBA / Xl 2002 I use a userform to make the user input in a time registration form. The format on the userform form side is .text. When saving this information to a different sheet I try to convert the text to values by changing the suffix from .text to .value. When the values are printed on the sheet, the comma (used as a delimiter in Danish language instead of "." ) has been deleted. Using the following code: Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" and enter the value 1,23456 in the form, I get the output in the following format 123.456 What can I do get the representation right? Thx in advance. Private Sub GemClick_Click() Dim i As Integer Dim dato As Date Worksheets("Timeseddel").Activate Range(Cells(15, 3), Cells(31, 7)).ClearContents Cells(7, 7).ClearContents Range(Cells(15, 6), Cells(31, 7)).Select Selection.NumberFormat = "0,0" ActiveWorkbook.Save Cells(15, 3).Activate With ActiveCell If ChkAltDato = True Then .Offset(-8, 4).Value = TxtAltDato.Text Else: .Offset(-8, 4).Value = txtDato.Text End If .Offset(0, 0).Value = LstNavn1.Text .Offset(0, 1).Value = TxtWkType1.Text .Offset(0, 2).Value = TextRmk1.Text .Offset(0, 3).Value = TextTimeDbt1.Value .Offset(0, 4).Value = TextTimeNonDbt1.Value .... End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting Text into Values | Excel Worksheet Functions | |||
Converting values to text | New Users to Excel | |||
Converting Text to Values | Excel Programming | |||
vba is converting text to values! | Excel Programming | |||
Can we make a cell behave like a list box and populate it with values for selection. | Excel Programming |