Can a range be copied if it varies in size?

T

TheMilkGuy

Hi folks, I am running Excel 2007.

I have a small table that gets generated based on up to 10 Point1 to
Point2 cells.

The table calculates distance from 1 to 2 (and some other sundry data
as well in subsequent columns)

Problem is that if I'm only going to Point6 I'm left with 4 more rows
of data. The Point6-Point7 row has 6 as a Column A start point but a
Zero in Column B as an end point.

This table is just a stepping-stone before all of this data makes its
way to the Sheet that will be printed. How might I go about copying
ONLY the rows in which Column B does not display Zero, whilst making
it possible to copy them all should the next generated set of points
use all 10? Or just 2?

The range I am working with is A30:T39

Many thanks!
Craig
 
T

TheMilkGuy

Hi Simon,

Thanks for the code, I realize my request is a bit wordy...

Your solution is exactly half of what I need :) instead of hiding the
cells with a "0" in Column B, I would like to take all of the cells
that were NOT to be hidden and copy them to another worksheet.

Here's an example of the chart if only One row was necessary:

A B C D E F G H
CYBG CYRJ 30000 300 260 53 283 287
CYRJ 0 30000 300

Since the second row is unnecessary, only row 1 would need to be
copied to my other worksheet.

Also, is it possible to make this work without any buttons? I can
live with them, don't get me wrong... Just curious.

Sorry to hijack so much of your time.

Cheers!
Craig
 
T

TheMilkGuy

Code's great, but the cells that got copied to Sheet2 almost all
showed up as #REF!

Have I done something wrong? Changing the code to xlCellTypeVisible
to xlCellTypeAllFormatConditions produces a 1004 error.

Craig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top