View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
[email protected] hglembin@googlemail.com is offline
external usenet poster
 
Posts: 6
Default Confusion Using Named Ranges

On Feb 16, 10:21*am, Dave Peterson wrote:
Dim myStr as string

For N = 1 To intHdrEnd
* mystr = myHdrArray(1, N)
* mystr = replace(mystr, chr(34),"_")
* mystr = replace(mystr, " ", "_")
* 'then use mystr as the name
* activecell.entirecolumn.name = mystr

There are other characters/strings that aren't legal for names, either.

wrote:

<<snipped







I'm very close to having this work as needed.


If I can edit the code that creates eachnamedrange so there are no
double quotes, all else works.
I found a post by OssieMac (Feb 5th) that states:


"The code that I have given you will create thenamedrange correctly
without
the double quotes. "


I cannot find any additional information on exactly what that code is.


This is the code I'm currentlyusingto create mynamedranges.
myHdrArray is an array that contains
each column header in order.


Dim intHdrEnd As Integer


'NAME A RANGE THAT REFERS TO EACH COLUMN BY HEADER NAME
Range("a1").Select
Selection.End(xlToRight).Select
intHdrEnd = ActiveCell.Column
Range("a1").Select
Dim shtMain As String
shtMain = "DATE SUMMARY"
For N = 1 To intHdrEnd
* * ActiveWorkbook.Names.Add Name:=CStr(myHdrArray(1, N)),
RefersTo:=Worksheets(shtMain).Range(ActiveCell.Col umn)
* * ActiveCell.Offset(0, 1).Select
* * If N = intHdrEnd Then Exit Sub
Next N


Any help correctly creating these defined names would be GREATLY
appreciated.


Thank you once again. *Without the help, I would be unable to get this
working.
hglembin


--

Dave Peterson- Hide quoted text -

- Show quoted text -


BINGO! Many thanks for your patience and willingness to help.

v/r,
hglembin