SOLVED
Home

Macro for deleting certain rows in some of the worksheets

Edrisbas
Occasional Contributor

Hello everyone. I'm looking for a macro that could help me deleting different rows in different sheets. For example rows 5 to 50 in worksheet A, rows number 7 to 40 in worksheet B and the rows number 10 to 60 in worksheet C. I was wondering if someone could help me with it. Thanks.

2 Replies
Solution

Hello @Edrisbas,

 

Try this Sub in VBA:

 

Sub Delete_Rows()

 

' Delete_RowsA Macro
Sheets("A").Select
Rows("5:50").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

' Delete_RowsB Macro
Sheets("B").Select
Rows("7:40").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

' Delete_RowsC Macro
Sheets("C").Select
Rows("10:60").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

End Sub

 

Hope this helps!

PReagan

 

Hi@PReagan 

It's exactly what I was looking for. Thank you very much.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies