View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Grant Reid Grant Reid is offline
external usenet poster
 
Posts: 51
Default Programatically deleting Range

Hi

In a particular worksheet I have a number of named ranges. In cell "AM2" I
have entered the name of a particular named range. I'm trying to put
together a piece of code that will look at the named range value entered in
"AM2", select that particular range, deleting it and then shifting the cells
beneath it up. This is what I have at the moment, but it's not working for
me (I get a Run_time error '1004' Method 'Range' of object '_Global' failed
error message).

Sub test()
Dim strQueryName As String

strQueryName = ActiveSheet.Range("AM2")

Range(strQueryName).Select
Selection.Delete Shift:=xlUp
End Sub

Hope someone can help - Regards, Grant