Deleting Rows

Foz1980

Board Regular
Joined
May 6, 2015
Messages
128
Hi all,

I am using the below code to delete a range of columns.

Code:
Range("A:A,C:C,D:D,E:E,F:F,G:G,I:I,K:K,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T").Delete

However, I also want a code to delete a range of rows but am struggling to work this out.

Please can someone help?

Cheers

Chris
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Like this:
Code:
    Range("10:10,15:15,20:20,25:25").Delete Shift:=xlUp


By the way, this:
Code:
Range("A:A,C:C,D:D,E:E,F:F,G:G,I:I,K:K,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T").Delete
can be condensed to this:
Code:
Range("A:A,C:G,I:I,K:K,M:T").Delete
(note how continuous columns can be combined)
 
Last edited:
Upvote 0
Brilliant, cheers Joe.
That's worked perfectly!
Also thanks for helping condense the column deletion too :)
 
Upvote 0
You are welcome!

You can use the same condense methodology on rows too, if you have consecutive rows to delete.
 
Upvote 0

Forum statistics

Threads
1,223,712
Messages
6,174,031
Members
452,542
Latest member
Bricklin

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