Results 1 to 3 of 3

edit data in userform and update spreadsheet

Threaded View

  1. #1
    Registered User
    Join Date
    03-07-2012
    Location
    Port Macquarie, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    edit data in userform and update spreadsheet

    Good morning everyone,
    I am having a problem getting my code to work. I am trying to find a record in a userform, edit it and then save it back to the spreadsheet. I have successfully used a combobox to locate the individuals name and show their details, and a hidden textbox to store the ID number. The code that I have sourced and customised works for changes in the first field only. Any changes I make to any other fields does not show on the spreadsheet. Any comments on the code would be appreciated.

    Private Sub cmdUpdate_Click()
    Dim Rw As Range
    For Each Rw In Range(cboName.RowSource)
            If cboName.Column(1) = txtID.Text Then
           
                cboName.Column(2) = cboContactType.Value
                cboName.Column(3) = cboSalutation.Value
                cboName.Column(4) = txtFirstname.Value
                cboName.Column(5) = txtSurname.Value
                cboName.Column(6) = txtJobTitle.Value
                cboName.Column(7) = txtCompany.Value
                cboName.Column(8) = txtStreetAddress.Value
                cboName.Column(9) = txtSuburb.Value
                cboName.Column(10) = cboState.Value
                cboName.Column(11) = txtPostcode.Value
                cboName.Column(12) = txtWorkPhone.Value
                cboName.Column(13) = txtMobile.Value
                cboName.Column(14) = txtEmail.Value
                cboName.Column(15) = txtStartDate.Value
                cboName.Column(16) = txtHourlyRate.Value
                cboName.Column(17) = txtComments.Value
                            
             End If
     Next Rw
    
    
    MsgBox ("Details updated")
    ActiveWorkbook.Save
    
    
    End Sub
    Cheers,
    Nunans
    Last edited by nunans; 03-08-2012 at 04:48 AM. Reason: SOLVED

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1