Hello

Just written a simple (or so I thought!) macro to give a name to dynamic range but get the runtime error 1004 message in the thread title.

Code is as follows:

PHP Code: 
Sub RangeNameUpdate()
'
RangeNameUpdate Macro
' Macro recorded 03/05/2012
'
Dim ws As Worksheet
Dim MyRange 
As Range

Set ws 
Worksheets("LOOKUP")
    
    
With Sheets("LOOKUP")
    
Columns("A:A").Select
    Selection
.Delete Shift:=xlToLeft
    Set MyRange 
ws.Range("A3:A"ws.Range("A" ws.Rows.Count).End(xlUp).Row)
    
End With
    ActiveWorkbook
.Names("WORKSHEETS").Delete
    MyRange
.Name "worksheets"
    
End Sub 
Error appears on line starting "Set MyRange = "

Would be grateful for the fix!

Thanks