copying data in column

Dummy Excel

Well-known Member
Joined
Sep 21, 2005
Messages
1,004
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Hi All,
can anyone help me with some VB code on coping a column of data which has blank cells? I don't want to use Range("A:A").copy as this will copy 1,048,576 cells.
thanks in advance
Sam
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
what u want to copy blank cell or non blank cell ? and can you pls explain in details ?
 
Upvote 0
i would like to copy the all the non blank cells. The number of rows will vary from week to week.
 
Upvote 0
There isn't a single command to copy all non-blank cells. Perhaps one of the below would suffice:
Code:
Range("A:A").SpecialCells(xlCellTypeFormulas).Copy
Code:
Range("A:A").SpecialCells(xlCellTypeConstants).Copy

Alternatively, if you have a single block of data that changes in size, something like this should work:

Code:
Range(Cells(2, 1), Cells(2, l).End(xlDown)).Copy
 
Upvote 0
try below code it will copy range from start A1 To last non blank cell
Code:
Sub Test()
Range("A1", Range("A" & Rows.Count).End(xlUp)).Copy
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,541
Latest member
iparraguirre89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top