c#: programmatically create a “named range” in worksheet scope

后端 未结 1 517
独厮守ぢ
独厮守ぢ 2021-01-19 03:42

How can we create a \'named range\' that has its scope set to a worksheet? (as we can do this manually from Excel, I guess there is a way to this in code)

S

相关标签:
1条回答
  • 2021-01-19 03:59

    Assumptions:
    Sheet1 has cells A1:A4, for which you want to create a named range

    VBA:

    Sheet1.Names.Add("tada", Sheet1.Range("A1:A4"))
    

    I suppose it will be identical in c# (except the ; at the end) and passing empty arguments for optional parameters.

    0 讨论(0)
提交回复
热议问题