+ Reply to Thread
Results 1 to 14 of 14

Thread: Userform data Amend/Modify not working

  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Userform data Amend/Modify not working

    Hai Everyone,
    I am trying to develop some data package for my office and created Userforms to add/input data, and amend/modify data. To input its working fine. But when I want to amend/modify the records its not working. I am new to Userforms, Codes. Can anyone help me by rectify me coding, for which I am attaching the sample sheet.

    Thanks in advance.
    ----Murthy.
    Attached Files Attached Files
    Last edited by tvrm1963; 02-27-2010 at 12:55 PM.

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: Userform data Amend/Modify not working

    Hi Murthy
    try..
    Private Sub cmdOkay_Click()
     NotNow = False
        
        n = Application.Match(Me.ListBox1.Value, Range("C:C"), 0)
              
        one = Me.txtfname.Text
       two = Me.txtlname.Text
        three = Me.txtsb.Text
        four = Me.txtloan.Text
         five = Me.txtopen.Text
        
        
        
        
        
        Cells(n, 1).Value = one
        Cells(n, 2).Value = two
        Cells(n, 3).Value = three
        Cells(n, 4).Value = four
        Cells(n, 5).Value = five
            
        NotNow = True
    End Sub
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Hai pike,
    Thank you very much. Its working. But in "Date of open" colum its taking as "mmddyy". I want it to be as "ddmmyy". Any code? Please help.
    With regards,
    =======Murthy

  4. #4
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Hai pike,
    Also, as I've modified the "Enter", "Amend" buttons on "Input" sheet, Amend is not working. I've done a mistake, unknowingly. Let me know that and please rectify me.
    Please see the attachment.
    With thanks.
    ==========Murthy
    Attached Files Attached Files

  5. #5
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: Userform data Amend/Modify not working

    Ok I'll Have a look to night
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  6. #6
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Hi Mr.Pike,
    I'm waiting for yr help. Please do find time to rectify my project. Many thanks in advance.

    ========Murthy

  7. #7
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: Userform data Amend/Modify not working

    appoligise
    just change
     n = Application.Match(Me.ListBox1.Value, Sheets("Sheet1").Range("C:C"), 0)
    Rajasthan Royals 2010
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  8. #8
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Hi Mr.Pike,
    Sorry to say, I think, I am not able to follow correctly.
    Its working diffrently. When I amended the data, its entering on sheet "INPUT".
    I attached the file. You can directly observe, whats happening.Please rectify the code and resubmit the file. Please do help me, I'm in hurry.
    Thanq very much for your response.

    ========Murthy
    Attached Files Attached Files

  9. #9
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Userform data Amend/Modify not working

    I'm puzzled. Why have a one page MultiPage,in fact why do you need two forms?

    The Edit form works on sheet1
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  10. #10
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Dear Mr.Pike,
    I've not conveyed you correctly, I think.
    What I want is, to "enter" as well as "edit" the data in "sheet1" only, but I want to hide it from my users. I want to allow the users to enter and edit the data by clicking the buttons "ENTER" and "AMEND" respectively.Data should not be seen directly.
    But now, its working on both sheets, which ever opens/unhidden.
    Sheet "INPUT" will always be opened, why because the "ENTER", "AMEND" buttons are there only.
    I think, now I am able to convey correctly. Please help me. Thanks.
    ======Murthy

  11. #11
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Userform data Amend/Modify not working

    Try answering questions asked. Your code has only some Variables declared which is very bad practice.

    To make it work requires very little work,but needs you to try to understand your code which you obviously don't- why have you got a Boolean Notnow that does nothing?

    here's amended code for the edit form
    Private Sub cmdCancel_Click()
    'Unload the userform
        Unload Me
    End Sub
    
    Private Sub cmdOkay_Click()
    
        With Sheets("Sheet1")
            n = Application.Match(Me.ListBox1.Value, .Range("C:C"), 0)
    
            one = Me.txtFName.Text
            two = Me.txtLName.Text
            three = Me.txtsb.Text
            four = Me.txtloan.Text
            five = DateValue(Me.txtopen.Text)
    
            .Cells(n, 1).Value = one
            .Cells(n, 2).Value = two
            .Cells(n, 3).Value = three
            .Cells(n, 4).Value = four
            .Cells(n, 5).Value = five
        End With
    End Sub
    
    Private Sub ListBox1_Click()
        Dim vreg As String, drow As Integer, c As Range
    
        Let vreg = ListBox1.Value
    
        With Sheets("sheet1").Range("C2:C100")
            Set c = .Find(vreg, LookIn:=xlValues, lookat:=xlWhole)
            If Not c Is Nothing Then
                 drow = c.Row
            End If
        End With
    
        With Me
            .txtFName.Value = Sheets("sheet1").Cells(drow, 1).Value
            .txtLName.Value = Sheets("sheet1").Cells(drow, 2).Value
            .txtsb.Value = Sheets("sheet1").Cells(drow, 3).Value
            .txtloan.Value = Sheets("sheet1").Cells(drow, 4).Value
            .txtopen.Value = Sheets("sheet1").Cells(drow, 5).Value
            End With
        End Sub
    
    Private Sub UserForm_Initialize()
    'UserForm1.listBox1.RowSource = "A2:G" & Cells(Rows.Count, "A").End(xlUp).Row
        frmEditData.ListBox1.RowSource = "FirstField"
    End Sub
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  12. #12
    Registered User
    Join Date
    04-22-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Userform data Amend/Modify not working

    Hi Pike,
    Wow, Excellent. Thats what I need. Its working cool.
    Thank you very much.

    ======Murthy

  13. #13
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Userform data Amend/Modify not working

    It's not Pike!
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  14. #14
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: Userform data Amend/Modify not working

    rabbits ducks all the same
    Thanks pike
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

+ Reply to Thread

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.2.0