Clear Content

Smurfit-Stone

Active Member
Joined
Dec 1, 2004
Messages
485
Hello Board,

I need a macro that will clear the content of multiple range names. I do not want to delete the range names, just clear the content in them. I need to clear a spreadsht daily to enter new data, there are 13 range names, that need to be cleared. Is there a easy way to do this? Thanks in advance.
 
Norie

What's the point of assigning the ranges to an array and then clearing the comtents of the array?

Why not just clear the contents directly?
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Boller, I'm still getting the error message "Wrong number of arguments or invalid property assignments", in a Compile Error message box. I thought I compiled it, but I must be doing something wrong. Please help.
 
Upvote 0
The code I posted isn't doing that - it's storing the names of the ranges in an array
 
Upvote 0
Boller, I'm still getting the error message "Wrong number of arguments or invalid property assignments", in a Compile Error message box. I thought I compiled it, but I must be doing something wrong. Please help.

Range("Unit123, Unit122, Unit120, Unit104, Unit125," & _
"Unit128, Unit133, Unit135, Unit140, UnitSlitter, " & _
"UnitWet, UnitDry, UnitPost").ClearContents
 
Upvote 0
The problem has been solved in this thread: http://www.mrexcel.com/forum/showthread.php?t=540240

Norie's array idea, I can see, could be very helpful for aesthetic purposes. However, we all have our own programming practices. Some like to store things in an array before using the items, some like to straight up use the items. ;)
 
Upvote 0
I actually did it for a few reasons.

One of which was basically because it works.

Another because, and it might be a long shot, the array is reusable.

Oh and I did mention in my last line of the post another reason.

Not sure about aesthetics - doesn't seem particularly artistic of beautiful to me, but then again most code doesn't.:)
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

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