Consulting

Results 1 to 13 of 13

Thread: Text Box

  1. #1

    Text Box

    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

  2. #2
    you can create a event procedure to do this activity

  3. #3
    can you specify your answer in detail?

  4. #4
    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

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I wouldn't do that, it makes editing awkward. Iwould add a small label to the right of the textbox wit the text 'ml'.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    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

  7. #7
    create a custom format for the cell or the range.

    #.## "g/dl"

  8. #8
    thanks for the help. it works fine

  9. #9
    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

  10. #10
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    [VBA]
    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
    [/VBA]

  11. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  12. #12
    thanks guys for the help. It was really helpful.

  13. #13
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •