trying to resolve range names to variable that vba can act on
There are a few names that excel uses that would damage your data if you ran
your code.
Instead, I'd make sure I was only processing the correct names. Did you use any
standard naming convention--starting with a common prefix???
BRC_Range1
BRC_Range2
....
If no, you could be explicit in the names you want to clear.
BRC wrote:
Good afternoon
I am trying to loop thru all ranges on a particular worksheet (sheet2)
and execute the command Range("loopthruallranges").ClearContents. the
clearcontents was provided by MVP Rick and it does exactly what i want
to do but my problem is resolving the names of the individual ranges
so that “loopthruallranges” can be replaced by a variable. I believe
it has to be something like
Sub clearcontents()
dim rn as string
for each range in worksheet (sheet2) range.
x=range.name
x.clearcontents
Next
end sub
But I have tried a multitude of different schemes and I get odd
errors. I have also notice active sheet can have impact on range names
that are enumerated. Any help is appreciated.
BRC
--
Dave Peterson
|