vba - Check a column to see if there is a named range in a column -
i'm dealing on 300 named ranges in spreadsheet each individual cells identify individual columns. (they not column names, there many duplicates)
question: if have named range is:
myrange = range(cells(2,7).address)
and active cell
cells(5,7)
is there way identify fact can identify column number in active cell, in same column named range, , return named range's name?
something like.......
function get_rangename(mycolumn) string each nm in thisworkbook.names if ***code coloumn number here*** = mycolumn get_rangename = nm.name end if next nm end function
i don't know how column number name
you can use intersect() function
function get_rangename(mycolumn long) string each nm in thisworkbook.names if not intersect(columns(mycolumn),range(nm)) nothing get_rangename = nm.name exit end if next nm end function
Comments
Post a Comment