Hi guys,

I'm using the following piece of code:


For k = 1 To j
                        
                        Application.Goto Reference:=Worksheets(Strg).Range("D" & k).Value
                        Application.CutCopyMode = False
                        Selection.Copy
                        Worksheets("Temp").Select
                        Selection.SpecialCells(xlCellTypeLastCell).Select
                        ActiveCell.Offset(1, 0).Select
                        Selection.End(xlToLeft).Select
                        ActiveSheet.Paste
Which simply uses a counter j to toggle through the used range on worksheet Strg, The values that are contained in Range("D" & j) are named range names.. i.e. the range itself exists on a different sheet but the names are listed one below the other. I am using this to copy the actual range and paste it onto Sheets("Temp").

The problem I am having is that sometimes the named range doesnt exist although the name is still included in the list on worksheet(Strg). and so when the macro runs if it doesnt find the named range from D & k then it repastes the last copied named range. How do I modify this in such a way that When a named range doesnt exist it goes next k without pasting?

regards