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

Select all data in a column that has blank cells

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
swjtx99
Asked:
swjtx99
1 Solution
 
regmigrantCommented:
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
 
swjtx99Author Commented:
Hi Regmigrant,

Thanks. Looks like that works!

Regards,

swjtx99
0
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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