LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting or changing a range name Dan Excel Discussion (Misc queries) 3 April 21st 06 10:53 PM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM
Deleting range names CiaraG[_4_] Excel Programming 1 May 10th 04 04:39 PM
Rename a Range, programatically? plh[_2_] Excel Programming 0 September 4th 03 05:11 PM
Deleting range not a row Robert[_13_] Excel Programming 3 September 1st 03 11:12 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"