Copy Range of Cells to Clipboard (No Blanks)

Manfred

New Member
Joined
Jan 11, 2014
Messages
10
Hi, I am trying to copy a range of cells from a table to clipboard. I am currently using the following:


<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">Sub Copy() Range("C13:L153").CopyEnd Sub</code></pre>
This works fine, however, there are a lot of rows without any data in them. How could I amend the code to not copy these blank rows?

<colgroup><col><col><col span="2"><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

shvraka

New Member
Joined
Dec 3, 2009
Messages
20
Hi, I am trying to copy a range of cells from a table to clipboard. I am currently using the following:


<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">Sub Copy() Range("C13:L153").CopyEnd Sub
</code>This works fine, however, there are a lot of rows without any data in them. How could I amend the code to not copy these blank rows?


Use something like this before Copy():

Selection.AutoFilter
ActiveSheet.Range("C13:L153").AutoFilter Field:=2, Criteria1:="<>"

.
.
.
.

Field:=2 indicates field by which you filter that range.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,620
Messages
5,625,894
Members
416,141
Latest member
Bartek9q

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
Top