Trouble with editing data from a user form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: ryssa (ryssa.18p5ir_at_excelforum-nospam.com)
Date: 07/01/04


Date: Wed, 30 Jun 2004 23:00:29 -0500

Hello all,
I am having trouble with editing a record with a user form.
I currently have an entry form which works with a save button to enter
records into a spreadsheet which goes like this:

Private Sub cmdSave_Click()

'Select workbook & move selection to cell A1
ActiveWorkbook.Sheets("Contacts").Activate
Range("A1").Select

'Move selection down until it finds an empty cell
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

'Write contents of form onto worksheet
ActiveCell.Value = txtName.Value
ActiveCell.Offset(0, 1) = txtDesignation.Value
ActiveCell.Offset(0, 2) = txtCompany.Value
ActiveCell.Offset(0, 3) = txtAddress.Value
ActiveCell.Offset(0, 4) = txtPhone.Value
ActiveCell.Offset(0, 5) = txtCellPhone.Value
ActiveCell.Offset(0, 6) = txtFax.Value
ActiveCell.Offset(0, 7) = txtEmail.Value
ActiveCell.Offset(0, 8) = txtEmailRefNo.Value
ActiveCell.Offset(0, 11) = txtWebsite.Value
ActiveCell.Offset(0, 9) = cboType.Value
ActiveCell.Offset(0, 10) = cboIndustry.Value
ActiveCell.Offset(0, 12) = cboFestival.Value
ActiveCell.Offset(0, 13) = txtProject.Value
ActiveCell.Offset(0, 16) = txtSFGAccountStatus.Value
ActiveCell.Offset(0, 15) = cboEIC.Value
ActiveCell.Offset(0, 14) = txtRemarks.Value

'Move selection back to beginning of worksheet for a new entry
Range("A1").Select
Call UserForm_Initialize
ActiveWorkbook.Save
End Sub

I have an edit button on the worksheet which opens a form to ask the
user for the row number to be edited. It then opens another form for
the user to edit that record.

What I do not know how to do is how to get the information from that
row in the sheet into the textboxes in the form for the user to edit
and save the new version of the record into the same row in the sheet.

Any help is greatly appreciated, thanks!

ryssa

---
Message posted from http://www.ExcelForum.com/


Relevant Pages

  • RE: Trouble with editing data from a user form
    ... "ryssa>" wrote: ... > I currently have an entry form which works with a save button to enter ... > 'Move selection back to beginning of worksheet for a new entry ... > the user to edit that record. ...
    (microsoft.public.excel.programming)
  • enable menu command not working
    ... Selection Change event of the worksheet that I want to control. ... The code works perfectly to disable the command on the edit menu. ...
    (microsoft.public.excel.programming)
  • Re: Sorting and Exporting
    ... Now you could cut this selection (Edit - Cut), ... I have a worksheet of data 50,000 rows by 9 columns ... > exporting it to a different worksheet in the same workbook or a similar ...
    (microsoft.public.excel.misc)
  • Help Can not Copy Sheet but Can add a New Sheet!!!
    ... I have a question Currently I have built a database and there is a user ... entry form which basically allows people to add users to the database ... this worksheet basically is a template and after thee user clicks save the ... Sheets("Add KOL Form").Select ...
    (microsoft.public.excel.programming)
  • PHP/MySQL and Checkboxes
    ... I've created an entry form for my database and it includes four ... I am also making an 'edit page', where I wan't to use the ... With the entry form I get an Undefined Index notice when the checkboxes ...
    (alt.php)