Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As a test, open a new workbook and run this code:
Sub ABCTest() ActiveWorkbook.Names.Add Name:="Name2", _ RefersTo:="Sheet1!$A$1:$A$10" ' Mix A1/R1C1 and omit equal sign ActiveWorkbook.Names.Add Name:="Name3", _ RefersToR1C1:="Sheet1!$A$1:$A$10" ' Should work ActiveWorkbook.Names.Add Name:="Name4", _ RefersTo:="=Sheet1!$A$1:$A$10" End Sub Name2 and Name3 will exhibit the behavior you describe (with quotes). Name4 works correctly I had this initially ' Mix A1 and R1C1 ActiveWorkbook.Names.Add Name:="Name1", _ RefersToR1C1:="=Sheet1!$A$1:$A$10" But it raised an error although it seems to me in earlier versions this caused the same problem. -- Regards, Tom Ogilvy "Barb Reinhardt" wrote in message ... Tom, I now have this as my code: Dim lastrow Dim rangename Dim seriesrange Dim CurBook Dim i Dim sht CurBook = Application.ActiveWorkbook.Name lastrow = Worksheets("RangeName").Cells(Rows.Count, "a").End(xlUp).Row Debug.Print lastrow For i = 2 To lastrow rangename = Workbooks(CurBook).Worksheets("RangeName").Range(" a" & i).Value seriesrange = Workbooks(CurBook).Worksheets("RangeName").Range(" c" & i).Value sht = Workbooks(CurBook).Worksheets("RangeName").Range(" d" & i).Value Debug.Print rangename; seriesrange; sht 'range name can't have a "'" or a "-" or a "%" or a " " or a "." or "(" or ")" or "+" 'Added the following for possible use later 'Sheets(sht).Activate ActiveWorkbook.Names.Add Name:=rangename, RefersToR1C1:=seriesrange 'Exit Sub Next My problem is that when I look at the range names, they look like this: ="OFFSET(ActItms!$B$33,0,0,1,min(chtlen,COUNTA(Act Itms!$33:$33)))" instead of =OFFSET(ActItms!$B$33,0,0,1,min(chtlen,COUNTA(ActI tms!$33:$33))) What do I need to change? I assume it's something in the ActiveWorkbook.Names line, but am not sure what. Thanks, Barb |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
converting email address names in a range of cells to real names | Excel Worksheet Functions | |||
adding range names | Excel Discussion (Misc queries) | |||
Adding Range Names | Excel Worksheet Functions | |||
Adding Range to Worksheet Names Collection | Excel Programming | |||
Adding and deleting Range Names | Excel Programming |