Question : How to assign a range name in code

I have the following (provided by an Expert-Exchange member) and it works perfectsly.  But now I need to assign this range to a name as this will be used in an import/export process.

set rng=range(cells(9,"A"),cells(rows.count,"D").end(xlup).offset(-1,0))

Answer : How to assign a range name in code

rng.Name = "myname"
Random Solutions  
 
programming4us programming4us