Creating a Userform to Search/Edit Worksheet Data

jimmybangs

New Member
Joined
Nov 28, 2008
Messages
36
Hi There,

I have set up a really simple UserForm in VBA that populates a worksheet that is made up of 4 columns - I've included the code below:

<a href="http://www.flickr.com/photos/67298551@N07/6165759057/" title="Table by digiteers, on Flickr"><img src="http://farm7.static.flickr.com/6159/6165759057_7684de272f.jpg" width="402" height="182" alt="Table"></a>

Code:
Private Sub UserForm_Initialize()
[INDENT]With DDSalutation[/INDENT]
[INDENT][INDENT].AddItem "Mr"[/INDENT][/INDENT]
[INDENT][INDENT].AddItem "Mrs"[/INDENT][/INDENT]
[INDENT][INDENT].AddItem "Miss"[/INDENT][/INDENT]
[INDENT][INDENT].AddItem "Ms"[/INDENT][/INDENT]
[INDENT]End With[/INDENT]
[INDENT]DDSalutation.Value = ""[/INDENT]
[INDENT]TxtFirstName.Value = ""[/INDENT]
[INDENT]TxtLastName.Value = ""[/INDENT]
[INDENT]TxtCompanyName.Value = ""[/INDENT]
[INDENT]TxtEmailAddress.Value = ""[/INDENT]
End Sub
Private Sub CommandCancel_Click()
[INDENT][/INDENT]Unload Me
End Sub
Private Sub CommandButtonSave_Click()
[INDENT]ActiveWorkbook.Sheets("Bookings").Activate[/INDENT]
[INDENT]Range("A1").Select[/INDENT]
[INDENT]Do[/INDENT]
[INDENT]If IsEmpty(ActiveCell) = False Then[/INDENT]
[INDENT][INDENT]ActiveCell.Offset(1, 0).Select[/INDENT][/INDENT]
[INDENT]End If[/INDENT]
[INDENT]Loop Until IsEmpty(ActiveCell) = True[/INDENT]
[INDENT]ActiveCell.Value = DSBookingDate.Value[/INDENT]
[INDENT]ActiveCell.Offset(0, 1) = DDSalutation[/INDENT]
[INDENT]ActiveCell.Offset(0, 2) = TxtFirstName[/INDENT]
[INDENT]ActiveCell.Offset(0, 3) = TxtLastName[/INDENT]
[INDENT]ActiveCell.Offset(0, 4) = TxtCompanyName[/INDENT]
[INDENT]ActiveCell.Offset(0, 5) = TxtEmailAddress[/INDENT]
[INDENT]Range("A1").Select[/INDENT]
End Sub

I wondered if there was a way in which I could set up another UserForm that would have the same appearance as this with the following areas added:

  • Ability to search by various fields
  • Ability to edit search returns within the form using a Next/Button to find the appropriate entry to amend
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,527
Messages
6,179,351
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top