View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
helmekki[_15_] helmekki[_15_] is offline
external usenet poster
 
Posts: 1
Default code to delete a defined name

HI all

i have several items (List) in column c........
I defined the items as names through the name dialoge box ..........
NB: i defined the items giving them the same names as they appera i
the list.

when i wnat to delete an item, i do this through inputbox....
see macro below...................
the chosen item is successfully deleted from the list (column c), but
have a problem deleting the chosen name from the name dialoge box...

i tried, but...........pls see macro below

any ideas are appreciated in advanced

yours............hesham

Sub DeleteItem()
Dim rMyCell As Range
Dim vInput2 As String

vInput2 = InputBox("Choose Item To Delete", "Delete An Item")
If vInput2 < "" Then
For Each rMyCell In Sheet3.Range("C2:C10")
If rMyCell.Value = vInput2 Then

Application.EnableEvents = False
ActiveWorkbook.Names("SPEAKERCol").Delete
ActiveWorkbook.Names vInput2.Delete
End sub

as you see, when i specify the name the code works fine, but when i us
the vInput2 (that carry the chosen name) to delete it from the nam
dialoge box, does not work....................................

--
Message posted from http://www.ExcelForum.com