Hi Dombek,

first,, once you have defined a range, you do not need to 'select' it in order to work with it.
you can rem out 'r.select' and the code should work the same as it does now

I'd suggest that you do also use 'readable' variable names. I typically use 'myRange' if working with one range only, or 'rInput', 'rOutput' etc for more descriptive code. Strings might be 'sName' and long integer might be 'lRow'. this doesn't help you with your question, but developing good coding techniques will definitely help you as your code becomes more complex.

From the look of it, you do not need to use Case to get your range name. If p = 11, and the range name = 'Slide11", you can
sSlideName = "Slide" & p
Your code can then be simplified to:
sSheetName = "The Name of the relevant worksheet"
set r = thisworkbook.worksheets(sSheetName).range(sSlideName)
You will notice thisworkbook here - this is usually assumed by excel, but I find that explicit definition helps readability when working with multiple workbooks etc.

re the 'why r.select didn't work' - it should have - assuming that there are no bugs in your code. Do you have the 'Locals' window open? I find this so useful that I have it permanently open in the VBE, and define objects frequently so that I can track them in this window. My first question is, is 'r' = nothing? this is one good reason you can not select it - and would mean that the 'set r =' has failed. Use the locals window to check this.


Let me know how you go
Werafa