PC Review


Reply
Thread Tools Rate Thread

apply all names

 
 
gelu.tudose@gmail.com
Guest
Posts: n/a
 
      5th Dec 2006
Hi there,

Objective: - raplace cell references with names

Question: - Is it possible to apply all the defined names without
having to select them one by one in the Apply Names dialog box?

Thank you

 
Reply With Quote
 
 
 
 
NickH
Guest
Posts: n/a
 
      5th Dec 2006
Here's something to get you started...

Sub NamesLoop()
Dim N As Name
Dim strIN As String
Dim strOUT As String

For Each N In ActiveWorkbook.Names
strIN = N.RefersTo

'----------------------------------------------------------
' strIN will be in a form something like -> "=Sheet1!R1C1"

' Here you need to parse strIN, make your change and put _
the result into strOUT
'----------------------------------------------------------

N.RefersToR1C1 = strOUT
Next N
End Sub

HTH NickH

 
Reply With Quote
 
New Member
Join Date: Jun 2007
Location: Raleigh, NC, USA
Posts: 2
 
      11th Jun 2007
Quote:
Originally Posted by NickH

'----------------------------------------------------------
' strIN will be in a form something like -> "=Sheet1!R1C1"

' Here you need to parse strIN, make your change and put _
the result into strOUT
'----------------------------------------------------------
Nick, the code you suggested is for changing what the names refer to. I think the original request was for applying the names, not changing what they refer to.

I've come across two bits of code for applying all names, the first of which doesn't execute (although Microsoft suggests it in an example in their help file - go figure), and the second of which partially executes, but stops as soon as there's a name that can not be applied to the sheet in question.

Code:
Sub ApplyNamesAll()
 
	Cells.ApplyNames
 
End Sub
Code:
Sub ApplyNamesAll2()
 
	Dim Nm As Name
	For Each Nm In ThisWorkbook.Names
		ActiveSheet.Cells.ApplyNames Names:=Nm.Name
	Next Nm
 
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
de-apply names Don Microsoft Excel Discussion 2 19th Apr 2010 05:48 PM
Apply Names in Formula Dave Unger Microsoft Excel Programming 2 10th Jan 2007 04:20 AM
How do you apply Names in formulas? =?Utf-8?B?TWFj?= Microsoft Excel Misc 2 2nd Aug 2005 11:51 PM
Selecting ALL names when using Insert/Names/Apply =?Utf-8?B?TWlrZQ==?= Microsoft Excel Worksheet Functions 3 23rd Apr 2005 05:20 PM
One More Try: Names/Apply on other worksheet =?Utf-8?B?TWlrZQ==?= Microsoft Excel Worksheet Functions 3 17th Apr 2005 09:40 PM


Features
 

Advertising
 

Newsgroups
 


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