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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default code to delete a defined name

It looks like what you want to do is:

ActiveWorkbook.Names(vInput2).Delete

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"helmekki " wrote in message
...
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 in
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 i
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 use
the vInput2 (that carry the chosen name) to delete it from the name
dialoge box, does not work.....................................


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to delete a defined name

It does not work...and
It gives me an error

The name is not valid

could you please tell me what to do

yours


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

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
Delete defined names beata Excel Discussion (Misc queries) 1 January 7th 08 09:44 PM
How do I delete a User defined default excel chart Jai Charts and Charting in Excel 1 November 7th 07 09:32 AM
Delete user-defined charts Lampman Charts and Charting in Excel 2 January 24th 07 01:49 AM
How to delete all defined names from a workbook? Dmitry Kopnichev Excel Worksheet Functions 15 November 14th 05 03:26 PM
How to delete all defined names from a workbook? Dmitry Kopnichev Links and Linking in Excel 15 November 14th 05 03:26 PM


All times are GMT +1. The time now is 06:17 AM.

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"