Delete a row in a protected document

Loin75

Active Member
Joined
Oct 21, 2009
Messages
281
Hi,

My workbook needs to be completely 100% protected from its user. So I have created a macro/userform that enables them to enter new data into the table. What I need now is another macro that will give them the option to delete any row of data that they have previously entered.

I figure that I will have to use some kind of "vlookup and/or print" code that will display to the user a list of the data that has been entered - at which point they can select one of them to remove from the table.

Can anyone please suggest a good starting point for this, bearing in mind that I am terrible at VB script, if it is at all possible...

Thanks in Advance.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Thanks for this, but there will only be one user using the workbook, so there would be no need to tag in this manner...

I am more interested in how to display a list of the data for them to pick from in the first instance.

Any other help greatly appreciated.

Thanks
 
Upvote 0
For anyone looking for a solution to this, i've ended up with the following code. The macro presents a list box showing a summary of my data. The one they select is then removed from the sheet by having the entire row deleted.

NB - the code doesn't mean much to me, but maybe someone else could make the most of it as well. Thanks to my bro for the assist...


Private Sub CommandButton1_Click()
ActiveSheet.Unprotect Password:="password"

x = 4
x = x + ListBox1.ListIndex
If ListBox1.ListCount = 2 Then
ActiveSheet.Range(x & ":" & x).Rows.ClearContents
Else
ActiveSheet.Range(x & ":" & x).Rows.Delete
End If
ActiveSheet.Protect Password:="password"

RemoveNewBus.Hide
End Sub
Private Sub CommandButton2_Click()
RemoveNewBus.Hide
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub UserForm_Activate()
ActiveSheet.Unprotect Password:="password"

'MsgBox Range("R_END").Offset(-1, 0).Value
'MsgBox Range("R_END").Address(0, 0)
ListBox1.ColumnCount = 2
ListBox1.RowSource = "B16:R_END"
Dim strRowSource As String
With ListBox1
strRowSource = .RowSource
.RowSource = vbNullString
'Set back so it updates, use a new RowSource
.RowSource = strRowSource
End With
ActiveSheet.Protect Password:="password"
End Sub
Private Sub UserForm_Initialize()
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,054
Messages
6,169,834
Members
452,284
Latest member
TKM623

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