PDA

View Full Version : Text Box



fiza
03-26-2010, 04:12 AM
I have a text box in my userform with the name txtVolume.

I want the text box after writing 200 or any amount to appear as 200ml after I press the tab.

for example
when I write 200 I want the textbox txtVolume to show 200ml
When I write 300 I want the text box txtVolume to show 300ml & so on.

Any help would be kindly appreciated

Thanks in advance

Regards
Fiza

MaayanSV
03-26-2010, 04:23 AM
you can create a event procedure to do this activity

fiza
03-26-2010, 04:26 AM
can you specify your answer in detail?

MaayanSV
03-26-2010, 04:36 AM
Private Sub txtVolume_AfterUpdate()

If IsNumeric(txtVolume.Value) Then
txtVolume.Value = TextBox1.Value + " ml"
End If

End Sub

keep this code inside the object and execute

Bob Phillips
03-26-2010, 04:39 AM
I wouldn't do that, it makes editing awkward. Iwould add a small label to the right of the textbox wit the text 'ml'.

fiza
03-26-2010, 04:55 AM
Thanks guys for the help & the recommendations. Now I would like to know how could I change the value of a cell in the work sheet to g/dl when I write a numeric value.

Suppose I write 23 in cell A1 I want the cell to appear as 23g/dl.

Thanks in adavance

MaayanSV
03-26-2010, 05:11 AM
create a custom format for the cell or the range.

#.## "g/dl"

fiza
03-26-2010, 05:24 AM
thanks for the help. it works fine

fiza
03-26-2010, 08:48 AM
I'm using the following code to copy the data in the text boxes mentioned in the code to cells of the sheet named in the code.

I want help to modify the code so that when I press the Save button in my useform, data in the text boxes will be copied to the sheets; "SalesReport" simultaneously to the first empty rows of the sheets "Analysis" & "Statistics".


Private Sub cmdSave_Click()
Me.Hide
With Worksheets("SalesReport")
.Visible = xlSheetVisible
.Range("C34") = Me.txtDate
.Range("G34") = Me.txtTime

End With
End Sub

SamT
03-26-2010, 09:01 AM
Private Sub cmdSave_Click()
Me.Hide
With Worksheets("SalesReport")
.Visible = xlSheetVisible
.Range("C34") = txtDate.Text
.Range("G34") = txtTime.Value 'Same as .Text

End With
End Sub

Bob Phillips
03-26-2010, 09:10 AM
Private Sub cmdSave_Click()
Me.Hide

With Worksheets("SalesReport")

.Visible = xlSheetVisible
.Range("C34") = Me.txtDate
.Range("G34") = Me.txtTime
End With

With Worksheets("Analysis")

.Visible = xlSheetVisible
With .Range("C1").End(xlDown)

.Value2 = Me.txtDate
.Offset(0, 4).Value2 = Me.txtTime
End With
End With

With Worksheets("Satistics")

.Visible = xlSheetVisible
With .Range("C1").End(xlDown)

.Value2 = Me.txtDate
.Offset(0, 4).Value2 = Me.txtTime
End With
End With
End Sub

fiza
03-26-2010, 09:14 AM
thanks guys for the help. It was really helpful.

fiza
03-31-2010, 11:18 AM
How can I make the values that I enter into the columns (D, H, I, M, N, O, P) of the worksheet “sales” to be copied into the columns (D, E, F, J, K, L, M) of the worksheet “withdraw” when I write the Customer ID in column C of the worksheet “withdraw” depending upon the last date the Customer ID was entered to the worksheet “sales”

In short, I want the columns(D, H, I, M, N, O, P) of the row which contains the last date Customer ID from the worksheet "sales" to be copied to the columns (D, E, F, J, K, L, M) that contains last date row where Customer ID is entered to the worksheet “withdraw”.





Regards