Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe something like
Sub BBB() Dim shtSup1 As Worksheet, Rng As Range Set shtSup1 = Sheets("Supplier") Set Rng = Union(shtSup1.Range("C6"), shtSup1.Range("C16"), _ shtSup1.Range("C23"), shtSup1.Range("C36"), _ shtSup1.Range("C56")) shtSup1.Names.Add Name:="Sup1_BCAPA_Ratings", RefersTo:=Rng, Visible:=True Application.Goto Reference:="Sup1_BCAPA_Ratings" End Sub Hope this helps, Hutch "Walter" wrote: shtSup1.Names.Add Name:="Sup1_BCAPA_Ratings", _ RefersTo:=Supplier!$C$6,Supplier!$C$16,Supplier!$C $23,Supplier!$C$36, _ Supplier!$C$56,Visible:=True I want to add named ranges in my workbook with VBA. However, the range that I have is discontiguous as noted above. I can enter it in the Insert/Name/Define and it works. How do I write the code so that it compiles in VBA? I keep getting an error. Supplier is the name of the worksheet. I am working in Excel 2003. Thank you! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Named ranges and pasting formulas with named references | Excel Programming | |||
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... | Excel Programming | |||
union of named ranges based only on the names of those ranges | Excel Programming | |||
Copy data in named ranges to a newer version of the same template to identical ranges | Excel Programming | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) |