.clearcontents seems to max out

d0wnt0wn

Well-known Member
Joined
Oct 28, 2002
Messages
771
hey guys.... i have a sheet with alot of areas that i need to clear the contents of once i have used the sheet. The problem is that using the built in macro maker it seems to max out how many areas i can do and not only that but it seems that after i go over a certain amount it seemingly randomly omits ranges... this example is not all of the area i want because the sheet goes down to 591 but for some reason the macro has omitted the ranges between 364 and 406 and it starts with c426 although i started on C2364 and 406 and it starts with c426 although i started on C2. any idea what is happening? I dont want to have to make 3 macros to do 1 job

Sub clearscores()
'
' clearscores Macro
'

Union(Range( _
"C426:C441,E426:M441,C2:C33,E2:M33,C36:C66,E36:M66,C69:C98,E69:M98,C101:C129,E101:M129,C132:C159,E132:M159,C162:C188,E162:M188,C191:C216,E191:M216,C219:C243,E219:M243,C246:C269,E246:M269,C272:C294,E272:M294,C297:C318,E297:M318,C321:C341,E321:M341,C344:C363" _
), Range("C407:C423,E407:M423")).Select
Selection.ClearContents
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You have apparently reached the limitations of the macro recorder. It might be an idea to name the desired cell ranges; ribbon> Formulas> Name Manager> New.
You can use this to name multiple separate cell ranges together. Clearing contents would be simple as
VBA Code:
Range("SomeName").ClearContents
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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