View Full Version : Solved: Delete same rows
Blackie50
03-21-2012, 03:49 AM
Hi,
Would like to delete the same rows from Sheet2 as I delete from Sheet1 - is there an easy way to do this - maybe a worksheet_change macro?
many thanks
Jon
wrightyrx7
03-21-2012, 08:06 AM
Do you mean the same row "number" or the same row that matches some criteria?
Regards
Chris
Blackie50
03-22-2012, 02:26 AM
Yes same row number(s) - could be number of rows all at once.
Was thinking of using input boxes to gather start row & end row info from user.
Any help appreciated
Jon
wrightyrx7
03-22-2012, 05:39 AM
This works for sheet1 and sheet2. If you highlight for example A1 and A5 then run this. It will delete Row 1 and row 5 from both sheets.
Doesnt matter if you run this macro on sheet1 or sheet2 the same rows will be deleted on both sheets.
Sub Test()
Set Rs = Selection
Sheets(Array("Sheet1", "Sheet2")).Select
Range(Rs.Address).EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveSheet.Select
End Sub
Hope it helps.
Regards
Chris
Blackie50
03-22-2012, 06:02 AM
Thanks for your help Chris - works fine
regards
Jon
wrightyrx7
03-22-2012, 06:07 AM
No problem :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.