Solved

Select all data in a column that has blank cells

Posted on 2014-02-22
2
313 Views
Last Modified: 2014-02-22
Hi,

I have a macro that copies a column from one sheet to another.

Column A has no blanks but column B does.

When I use the following to copy, it only selects data down to the first blank cell instead of the entire column.

    Sheets("test1").Select
    Range("B1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("test2").Select
    Range("B1").Select
    ActiveSheet.Paste

I'm guessing the best way is to set a "range" which would be the number of rows with data in column A, then use that range value to copy columns that have blank cells but haven't found a good useable example googling.

Thanks in advance,

swjtx99
0
Comment
Question by:swjtx99
2 Comments
 
LVL 19

Accepted Solution

by:
regmigrant earned 500 total points
ID: 39879685
The simple change to select the entire common is
Range("B:B") and take out Range(Selection, Selection.End(xlDown)).Select all together

do you need a more targeted approach?
0
 

Author Closing Comment

by:swjtx99
ID: 39879689
Hi Regmigrant,

Thanks. Looks like that works!

Regards,

swjtx99
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

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Viewers will learn how to apply various conditional formatting in Excel 2013.

911 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

21 Experts available now in Live!

Get 1:1 Help Now