Posts by Mudasser

    Thanks Roy. That indeed does the job! I am just moving the sheets after a tab called "Exclude>>", so have just used

    Code
    1. Sheets(Rcl.Value).Move After:=Sheets("Exclude>>")

    One more question (not sure if I need to post this as a new thread?), but what do I need to add to your code to first check that the range is NOT empty/invalid? As there is a possibility (determined by user inputs) that the dynamic range ("sheets_to_exclude") does not contain any values (i.e. the dynamic range name returns #Ref, and so the VBA code you provided does not work.. so I first need to check that the range is valid and then loop though if it is).


    Thank you so much.



    Carim, good advice, but I wasnt sure how to use record macro to record what I need in this instance, as it involved range names,

    Hi there,


    I'm new to this site, so please be patient!


    The problem I am trying to solve is to that I want to move worksheets (using a simple macro) in my workbook, with the name of the worksheets to be moved specified by a named range (say, "sheets_to_exclude"). To be clear, the range contains the names of each sheet. The range is also dynamic, as the sheets to be moved are to be determined by a set of inputs which can change.


    I am not sure how to use the Sheets() object with a named range , and also am not sure if the dynamic range will cause issues. Any help welcome, I am sure it's an easy answer!


    Thanks in advance!