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.
Last edited by tvrm1963; 02-27-2010 at 12:55 PM.
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
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
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
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
Hi Mr.Pike,
I'm waiting for yr help. Please do find time to rectify my project. Many thanks in advance.
========Murthy
appoligise
just change
Rajasthan Royals 2010n = Application.Match(Me.ListBox1.Value, Sheets("Sheet1").Range("C:C"), 0)
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
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
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)
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
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)
Hi Pike,
Wow, Excellent. Thats what I need. Its working cool.
Thank you very much.
======Murthy![]()
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)
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks