How to delete entire.column between a Range.

Trev0j

New Member
Joined
May 27, 2018
Messages
28
Hello,

what I want to do is:

i have a ranged name" Adjusted" and ranged name " Start" which is located in A1. i want to delete entire columns between range "Start" and "Adjusted". wherever the range " Adjusted" is located.
btw, before this code, need to find the range "Adjusted" and delete all the columns in between A1

I am thankfull for every help!
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Does the "Adjusted" range ever contain more than one column?
If so, what do you want it to do in that instance?

Let's say that "Adjusted" is in column D. When you say delete entire columns between "Start" and "Adjusted", does that mean just deleting columns B and C in that instance?
 
Upvote 0
Hello,

what I want to do is:

i have a ranged name" Adjusted" and ranged name " Start" which is located in A1. i want to delete entire columns between range "Start" and "Adjusted". wherever the range " Adjusted" is located.

I am thankfull for every help!

Are the ranges "Start" and "Adjusted" full column ranges?

Do the ranges "Start" and "Adjusted" each contain only one column?
 
Upvote 0
How about
Code:
Sub del()
Range(Range("Start").Offset(, 1), Range("Adjusted").Offset(, -1)).EntireColumn.Delete
End Sub
 
Upvote 0
Fluff's code works for me.
Do you have any merged or protected ranges in your sheet?

If you run this code, what does it return?
Code:
Sub Test()
    MsgBox Range("Start").Address & vbCrLf & Range("Adjusted").Address
End Sub
 
Upvote 0
Fluff's code works for me.
Do you have any merged or protected ranges in your sheet?

If you run this code, what does it return?
Code:
Sub Test()
    MsgBox Range("Start").Address & vbCrLf & Range("Adjusted").Address
End Sub

Thanks.its the same error: Method 'Range' of object'_Global' failed
 
Upvote 0
Are both named ranges on the active sheet, when you ran the code?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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