Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VBA: Delete name range

I want to delete the named range that is created while updating my web query.
Can someone help with the delete code, below is what I've tried and it
doesn't delete. The first arrow is what the range is named, the second is to
delete the named range although it doesn't work.


Sub Macro14()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/ks?s=" & Range("B3").Value,
Destination:=Range("J5"))
---- .Name = "Macro" & Range("B3").Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "42,45,48"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
---- ActiveWorkbook.Names("Macro" & Range("B3").Value).Delete
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default VBA: Delete name range

This might work

ActiveSheet.Names("Macro" & Range("B3").Value).Delete

"CM4@FL" wrote:

I want to delete the named range that is created while updating my web query.
Can someone help with the delete code, below is what I've tried and it
doesn't delete. The first arrow is what the range is named, the second is to
delete the named range although it doesn't work.


Sub Macro14()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/ks?s=" & Range("B3").Value,
Destination:=Range("J5"))
---- .Name = "Macro" & Range("B3").Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "42,45,48"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
---- ActiveWorkbook.Names("Macro" & Range("B3").Value).Delete
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Delete name range

For Each n In ActiveSheet.Names
If InStr(c, "Macro") Then n.Delete
Next
But better to establish the query and just refresh using your range instead
of new one each time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CM4@FL" wrote in message
...
I want to delete the named range that is created while updating my web
query.
Can someone help with the delete code, below is what I've tried and it
doesn't delete. The first arrow is what the range is named, the second is
to
delete the named range although it doesn't work.


Sub Macro14()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/ks?s=" & Range("B3").Value,
Destination:=Range("J5"))
---- .Name = "Macro" & Range("B3").Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "42,45,48"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
---- ActiveWorkbook.Names("Macro" & Range("B3").Value).Delete
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Delete name range

Oops

For Each n In ActiveSheet.Names
If InStr(n.Name, "Macro") Then n.Delete
Next n
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
For Each n In ActiveSheet.Names
If InStr(c, "Macro") Then n.Delete
Next
But better to establish the query and just refresh using your range
instead of new one each time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CM4@FL" wrote in message
...
I want to delete the named range that is created while updating my web
query.
Can someone help with the delete code, below is what I've tried and it
doesn't delete. The first arrow is what the range is named, the second is
to
delete the named range although it doesn't work.


Sub Macro14()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/ks?s=" & Range("B3").Value,
Destination:=Range("J5"))
---- .Name = "Macro" & Range("B3").Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "42,45,48"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
---- ActiveWorkbook.Names("Macro" & Range("B3").Value).Delete
End Sub



Reply
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
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
Range.Delete and Range.Resize.Name performance issues Test.File Excel Programming 0 February 15th 05 03:33 PM
delete name range masterphilch Excel Programming 3 October 11th 04 05:50 PM
DELETE RANGE NAME gus Excel Programming 3 September 23rd 03 07:25 AM


All times are GMT +1. The time now is 03:19 PM.

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

About Us

"It's about Microsoft Excel"