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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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.
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

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