Solved

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

Posted on 2015-02-11
2
50 Views
Last Modified: 2016-02-10
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 .
0
Comment
Question by:AMixMaster
2 Comments
 
LVL 11

Accepted Solution

by:
jkpieterse earned 500 total points
ID: 40605015
(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"
0
 

Author Closing Comment

by:AMixMaster
ID: 40605857
works like a charm
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now