LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Names.Add

Having trouble with adding a named range via code using a three column list€¦
The sheet the first named range should adhere to is ='Data Sheet'!$I$47
What I get is ="Data Sheet'!$I$47" which is wrong.
When concatenating €˜ to varC I get €œData Sheet'!$I$47" also not valid.
How do I resolve getting each named range bound to the their respective
sheets correctly.

Appreciatively,
Arturo

varA=_2007
varB= Data Sheet'!$I$47
varC=Col1

Sub NameAdd()
Dim myRange As Range
Dim rowZ As Integer
Dim varA As String
Dim varB As String
Dim varC As String
Dim CntrA As Integer

Set myRange = Sheets("NamedRanges").Range("A1").CurrentRegion
rowZ = myRange.Rows.Count
For CntrA = 1 To rowZ
varA = Sheets("NamedRanges").Cells(CntrA, 1).Value
varB = Sheets("NamedRanges").Cells(CntrA, 2).Value
varC = Sheets("NamedRanges").Cells(CntrA, 3).Value
ActiveWorkbook.Names.Add Name:=varC, _
RefersToR1C1:=varB
ActiveWorkbook.Names(varA).Delete
Next CntrA
End Sub
 
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
converting email address names in a range of cells to real names John Excel Worksheet Functions 1 May 19th 10 03:44 PM
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
Sorting and matching rows of names with Socials with master list and eliminating the extra names Giacomo Excel Worksheet Functions 1 March 10th 07 01:52 AM
return all worksheet tab names and chart sheet tab names in report - an example DataFreakFromUtah Excel Programming 2 October 6th 04 08:09 PM
Change names of files in a folder to match names in Excel Column saybut Excel Programming 4 February 9th 04 06:26 PM


All times are GMT +1. The time now is 08:49 PM.

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

About Us

"It's about Microsoft Excel"