When I had to define some ranges programatically (sp?), I came up with the following for the cell "L4":
It occurred that this is a pretty tough statement to write if I wanted to define a name for a cell in column "HG". Who knows what the column number of column "HG" is? So I rewrote the statement like this:ActiveWorkbook.Names.Add Name:="RngNm1", RefersToR1C1:="=Main!R4C12"
I gotta admit I was surprised when it worked!ActiveWorkbook.Names.Add Name:="RngNm2", RefersToR1C1:="=Main!R4C" & Range("HG1").Column
If any of you folks have a slicker (and shorter) statement for the name-defining task, I'd love to see it.