Solved

Select all data in a column that has blank cells

Posted on 2014-02-22
2
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Viewers will learn the basics of formula auditing in Excel 2013.
Viewers will learn a basic relationship technique in Power Pivot for Excel 2013.

739 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