View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arishy[_2_] Arishy[_2_] is offline
external usenet poster
 
Posts: 31
Default Dynamic Range Offset causing problem with this code

I have a wb with several sheets, each has a dynamic range with a name
CODExx.

The following code - partly from the posts here - works if I have NONE
dynamic range (=offset(sheets......etc)

Public Sub moveplist()
Dim rcnt As Integer
Dim nme As Variant
For Each nme In ActiveWorkbook.Names
If Left(nme.Name, 4) = "CODE" Then
'Debug.Print nme.Name
'Debug.Print Range("nme.Name")
Range(nme.Name).Copy Destination:= _
Worksheets("PTable").Cells(1 + rcnt,
1).Range(Range(nme.Name).Address)
End If
rcnt = rcnt + Range(Range(nme.Name).Address).Rows.Count
Next nme

End Sub

If I use dynamic range I get an error msg
Rune Time error '1004'
Method 'Range' of Object 'Global' failed

Can you help