Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default names and deleting them

I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....

i tried to do this...

Private sub whateveritiscalled()

dim n as name
dim wkb as workbook

set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important

for each n in wkb.names
n.delete

next

etc...etc...etc..

however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default names and deleting them

Are you sure the error is at the 'n.delete'? The following code works
he

Sub whatever()

Dim n As Name
Dim wkb As Workbook

Set wkb = Workbooks.Add
ThisWorkbook.ActiveSheet.Cells.Copy

wkb.Activate
ActiveSheet.Paste
For Each n In wkb.Names
n.Delete
Next

Application.CutCopyMode = False

End Sub

/ Tyla /



On Mar 7, 9:26 pm, Steven Cheng
wrote:
I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....

i tried to do this...

Private sub whateveritiscalled()

dim n as name
dim wkb as workbook

set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important

for each n in wkb.names
n.delete

next

etc...etc...etc..

however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default names and deleting them

yes, I was walking through the code and noticed that the n variable revealed
an error "NAME#"...the only thing that I can see is that in your code you
activated wkb first.

I'll give that a shot. but thanks for responding in any case.

" wrote:

Are you sure the error is at the 'n.delete'? The following code works
he

Sub whatever()

Dim n As Name
Dim wkb As Workbook

Set wkb = Workbooks.Add
ThisWorkbook.ActiveSheet.Cells.Copy

wkb.Activate
ActiveSheet.Paste
For Each n In wkb.Names
n.Delete
Next

Application.CutCopyMode = False

End Sub

/ Tyla /



On Mar 7, 9:26 pm, Steven Cheng
wrote:
I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....

i tried to do this...

Private sub whateveritiscalled()

dim n as name
dim wkb as workbook

set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important

for each n in wkb.names
n.delete

next

etc...etc...etc..

however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default names and deleting them

What version of Excel are you using? In Excel 2003, the statement:
wkb.ActiveSheet.Range("a1").Paste
is invalid. My code simply used a different syntax.

If you take out everything but the "For" loop in your original code,
does it work?

/ Tyla /


On Mar 7, 10:11 pm, Steven Cheng
wrote:
yes, I was walking through the code and noticed that the n variable revealed
an error "NAME#"...the only thing that I can see is that in your code you
activated wkb first.

I'll give that a shot. but thanks for responding in any case.

" wrote:
Are you sure the error is at the 'n.delete'? The following code works
he


Sub whatever()


Dim n As Name
Dim wkb As Workbook


Set wkb = Workbooks.Add
ThisWorkbook.ActiveSheet.Cells.Copy


wkb.Activate
ActiveSheet.Paste
For Each n In wkb.Names
n.Delete
Next


Application.CutCopyMode = False


End Sub


/ Tyla /


On Mar 7, 9:26 pm, Steven Cheng
wrote:
I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....


i tried to do this...


Private sub whateveritiscalled()


dim n as name
dim wkb as workbook


set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important


for each n in wkb.names
n.delete


next


etc...etc...etc..


however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default names and deleting them

Okay found it. I am using XL2007 and there appears to be a hidden name
called "_xlfn.SUMIFS" and yes my file uses SUMIFS function.

what is this name for?

" wrote:

Are you sure the error is at the 'n.delete'? The following code works
he

Sub whatever()

Dim n As Name
Dim wkb As Workbook

Set wkb = Workbooks.Add
ThisWorkbook.ActiveSheet.Cells.Copy

wkb.Activate
ActiveSheet.Paste
For Each n In wkb.Names
n.Delete
Next

Application.CutCopyMode = False

End Sub

/ Tyla /



On Mar 7, 9:26 pm, Steven Cheng
wrote:
I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....

i tried to do this...

Private sub whateveritiscalled()

dim n as name
dim wkb as workbook

set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important

for each n in wkb.names
n.delete

next

etc...etc...etc..

however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default names and deleting them

Beats me! I'll have to play with it under XL12 -- probably tomorrow.
Hopefully wiser heads than ours can answer.

/ Tyla /

On Mar 7, 10:26 pm, Steven Cheng
wrote:
Okay found it. I am using XL2007 and there appears to be a hidden name
called "_xlfn.SUMIFS" and yes my file uses SUMIFS function.

what is this name for?

" wrote:
Are you sure the error is at the 'n.delete'? The following code works
he


Sub whatever()


Dim n As Name
Dim wkb As Workbook


Set wkb = Workbooks.Add
ThisWorkbook.ActiveSheet.Cells.Copy


wkb.Activate
ActiveSheet.Paste
For Each n In wkb.Names
n.Delete
Next


Application.CutCopyMode = False


End Sub


/ Tyla /


On Mar 7, 9:26 pm, Steven Cheng
wrote:
I am running a code that is trying to clear out the names that are being
copied over from one workbook to another....


i tried to do this...


Private sub whateveritiscalled()


dim n as name
dim wkb as workbook


set wkb = workbooks.add
thisworkworkbook.activesheet.cells.copy
wkb.activesheet.range("a1").paste 'actually it is pastespecial...not important


for each n in wkb.names
n.delete


next


etc...etc...etc..


however, it keeps getting an error on the n.delete statement...run time
error 1004...must be missing something....can anyone help.



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
Deleting of names kurt Excel Programming 3 November 20th 06 10:11 AM
deleting names from the name box Amy C Excel Discussion (Misc queries) 4 May 12th 06 11:00 AM
deleting duplicate names chris Excel Worksheet Functions 1 February 16th 06 08:42 PM
Deleting Names Rob Bovey Excel Programming 0 September 14th 04 08:30 PM
Deleting workbook names w/ VB Big-E Excel Programming 6 April 28th 04 07:01 PM


All times are GMT +1. The time now is 10:03 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"