Code to select print out areas

  • Thread starter Thread starter Jonsson
  • Start date Start date
J

Jonsson

Hi all,

I have a spreadsheet with about 200 rows.Each row has formulas. Is there a
way to do a code that only print out the areas containing a value (numbers)
in these areas, and not if it´s only formulas.

What can I say, I want a button, and when I press that button the areas
that are printed are the one´s containing the numbers.
That means that the code has to have the properties to increase or decrease
the area depending whether there are numbers or not.


Example:

A Return
3 1000 Print row=YES
4 Formula Print row=NO
5 3000 Print=rowYES

7 Formula Print row=NO
8 4000 Print=rowYES
9 Formula Print row=NO

...............and so on

Thanks,

Thomas
 
you would have to loop through your rows and hide them based on the value in
the formula

If they produce a number or text. you could do

On error Resume NExt
set rng = Columns(1).SpecialCells(xlformulas,xlTextValues)
On error goto 0
if not rng is nothing then
rng.EntireRow.Hidden = True
Activesheet.Printout
End if
 

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

Similar Threads

VBA to set dynamic print area 1
Setting Print Area 5
Dynamic Print Area 5
Set Print Area with Dynamic Start Point 2
Loop & Print 17
Print Area Range Selection 2
Macro to control Print area/view 2
Dynamic Print Area 2

Back
Top