DMFisher

New Member
Joined
Apr 22, 2016
Messages
35
Hi,

Is it possible to have a macro that deletes data from a table?

e.g - If cell I10 (Sheet2) matches data in a table on Sheet1 then delete the row that the data is stored in on Sheet1
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I have changed the sheets from Sheet1 to Storage and Sheet2 to Remove Storage Loc.


Sub Remove_Storage_Location()
'
' Remove_Storage_Location Macro
'
Sheets("Storage").Activate
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "d").End(xlUp).Row
For i = Lastrow To 1 Step -1
If Cells(i, 2).Value = Sheets("Remove Storage Loc.").Range("d10").Value Then
Rows(i).Delete
End If
Next
ActiveWindow.ScrollWorkbookTabs Sheets:=1
ActiveWindow.ScrollWorkbookTabs Sheets:=1
ActiveWindow.ScrollWorkbookTabs Sheets:=1
ActiveWindow.ScrollWorkbookTabs Sheets:=1
Sheets("Remove Storage Loc.").Select
Selection.ClearContents
'
'
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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