Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Refresh User Form (2003 SP2)

    Good evening

    I am sure that my user form was refreshing this morning and now this evening it is not, I can't remember changing anythng either, can anybody spot what might have changed to stop the user form refreshing / clearing

    Private Sub TxtCost_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    txtCost = Format(txtCost, "0.00")
    End Sub

    Private Sub cmbCost_Click()
    Dim Irow As Long
    Dim c As Long
    Dim Ws As Worksheet

    Set Ws = Worksheets("Lists")

    Irow = Ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

    With Ws

    .Cells(Irow, 1).Value = Me.txtBoxName
    .Cells(Irow, 2).Value = Me.txtCost
    .Cells(Irow, 3).Value = Me.txtSupplier

    Exit Sub

    End With

    Me.txtBoxName.Value = ""
    Me.txtCost.Value = ""
    Me.txtSupplier = ""
    Me.txtBoxName.SetFocus

    End Sub

    Private Sub cmbCloseForm_Click()
    Unload Me
    End Sub

    Thanks alot

    Cheers

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Refresh User Form (2003 SP2)

    Why do you have a line Exit Sub in the middle of cmbCost_Click? It means that the rest of the lines until End Sub is never executed.

  3. #3
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refresh User Form (2003 SP2)

    Thanks Hans

    As mentioned before VBA is a mystery to me and I am slowly trying to get to grips with it, I think the main problem is that when you read up and copy other pieces of code that you think will help you tend to leave little bits and pieces behind and don't realise, hence the shout for help from the experts <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Cheers

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

Posting Permissions

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