Excel Named range not adding successfully
Hi,

I'm using a macro to import some stuff into a sheet to be used as a lookup and so I wanted to refer to it by a name.  I've stuck the following code in and the range select statement works but the ActiveWorkbook.Names.Add doesn't seem to be adding anything, but isn't triggering an error either.  x is definitely storing the correct row number from an earlier loop.  Any ideas?

My code snippet is:

    RowColStr1 = "I2:K" & CStr(x)
    RowColStr2 = "Lookups!R2C9:R" & CStr(x) & "C11"
    Range(RowColStr1).Select
    ActiveWorkbook.Names.Add Name:="StockList", Visible:=True, RefersToR1C1:=RowColStr2

and I've tried with and without the explicit reference to the sheet.
February 25th, 2015 10:13pm

Hi,

This is the forum to discuss questions and feedback for Microsoft Excel, your issue is related to code, please post the question to the MSDN forum for Excel

http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

George Zhao
TechNet Community Support

Free Windows Admin Tool Kit Click here and download it now
February 27th, 2015 9:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics