Solved

Select all data in a column that has blank cells

Posted on 2014-02-22
2
316 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
Video by: Zack
Viewers will learn about various customizable options in Excel 2013.
Viewers will learn a basic relationship technique in Power Pivot for Excel 2013.

685 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