The only problem is that the code works, but
not as intended - if your code doesn't do what you want it to be doing, then it's not ready for a peer review (and trust me, it needs one! ;)... you need to pass a
Worksheet
object as a parameter to your procedure, and then have some code that will iterate the sheets you're interested in, and call the above
Sub
with the worksheet parameter. On this site answers won't change
what the code is doing, we'll give you hints on what to change to better
how the code is doing what it does. Asking to change
what the code does is off-topic :( —
Mat's Mug 23 secs ago