Delete rows from multiple sheets based on value from dropdown box

jimmisavage

Board Regular
Joined
Jun 28, 2017
Messages
130
Hi,
On my Home sheet I have a dropdown box in cell E26. I've created a button just above this box so a user can delete some information.

I need a macros to assign to my button, that will search sheets 'Breakfast' 'Lunch' 'Dinner' and 'Snacks' and delete any row that has the text the user chose from the dropdown box in cell E26. This text will appear in column A on the sheets (if its there at all).

Many thanks
Stuart
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
something along the lines of

Sub Delete_Rows()
Application.ScreenUpdating = False
Dim lr As Long
Dim w As Long
Dim ws As Worksheet
Dim del_val As String

del_val = Range("e26").Value



For Each ws In Worksheets

If ws.Name = "Breakfast" Or ws.Name = "Lunch" Then

ws.Activate

lr = Range("a" & Rows.Count).End(xlUp).Row

For w = lr To 2 Step -1
If Cells(w, "A").Value = del_val Then
Cells(w, "A").EntireRow.Delete
End If
Next w
End If
Next ws
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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