• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 70
  • Last Modified:

Use VBA to create a named range from a column of data, exclude blanks from the resulting name.

I want to create a named range by selecting only the cells in a column that contain data,
Data in the column can easily be sorted to move all the cells with  data to the top before defining the name .
1 Solution
(re)Sorting the data will wreck the range name, it will keep pointing to the same cells. The syntax for defining the name is:

intersect(activesheet.usedrange,Range("A:A")).SpecialCells(xlCellTypeVisible).Name = "TheName"
AMixMasterAuthor Commented:
works like a charm
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now