Add/View/Update/Delete buttons

  • Thread starter sandip.dhamapurkar
  • Start date
S

sandip.dhamapurkar

New to excel vba for userforms. I have a userform with two labels and
two textboxes. Label for Membership number (name=lMemNo), Label for
Name of the Distributor (name=lDistributor) Textbox for Membership
number (name=txtMemNo), Textbox for Name of the Distributor
(name=txtDistributor) and I have Six buttons Add (name=bAdd) View
(name=bView) Update (name=bUpdate) Delete (name=bDelete) Save
(name=bSave) and Show (name=bShow)

I need some of the macro experts to write small codes for each of these
buttons.

On form activate, both textboxes should be disabled.

If anybody clicks on Add button, both textboxes should be enabled,
after user enters values for txtMemNo and txtDistributor and clicks on
bSave, it should find the last row in sheet2 and save the values in the
textbox in column A and B respectively.

If anybody clicks on View button, only txtMemNo button should be
enabled. After entering a membership number, and clicking on bShow
button, it should show the respective name of the distributor in the
txtDistributor textbox (Disabled).

If anybody clicks on Update button, both textboxes should be enabled,
after user enters values for txtMemno, it should show the respective
name of the distributor in the txtDistributor texbox (Enabled). After
making any changes to either textbox and clicking on bSave, it should
change the previous record listed in the excel file with this new one.

If anybody clicks on Delete, only txtMemno button should be enabled.
After entering a membership number, it should promt "Are you sure you
want to delete - Yes/No" If Yes, delete it from the worksheet.

I tried searching some templates/samples on google but could not find
any.

Note: I have two sheets on my workbook. Sheet1 and Sheet2. I have kept
Sheet1 blank with gridlines off so that when the form is active, it
displays blank sheet behind. I want all my data in sheet2 and during
execution of any code, sheet2 should not be displayed. I don't want to
show my records to the user behind the form.

Sandy
(e-mail address removed)
 
M

Mark Driscol

The forum is really a place to ask specific questions. When you say
I need some of the macro experts to write small codes for each of these
buttons.

I don't know that you will get much response when it isn't apparent how
much effort you have put in yourself. What you are asking is for
someone to do the work for you. There are many good books where you
can learn about these things, such as one of John Walkenbach's Power
Programming for Excel books.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top