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>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,657
Messages
5,838,631
Members
430,558
Latest member
Krampus

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