Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Variable Ranges for Print Areas

I have a table made up of several columns and a variable number of rows
dependent on the entries required in different situations.When the table has
been completed there will be several entries in column A for example which
will be duplicated, although the values in the rows will be different. ie
Column A indentifies the field being recorded. The table is sorted by Column
A, by code, so that these entries are contiguous. ie there could be 7 rows
for Field 1, 12 rows for Field 2, etc. There could be up tp 100 Field 1
Field 2 etc. What I want to do is indentify all the entries for each of
these different row entries and set the relevent rows and columns as a print
area which I would print along with some header rows. Thus I would print a
page for the entries relating to Field 1, another for field 2 etc. I had set
up print areas using dynamic named ranges but I do not know how to indentify
and show where a row has changed from one value to another. I hope this is
understandable and if so I would value any guidance.

Kind Regards,
Graham Haughs
Turriff
Scotland.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Variable Ranges for Print Areas

Graham

Try this for starters

Sub PrintByField()

Dim cell As Range
Dim lCount As Long
Dim rCol As Range

'Get the last cell in column A
With Sheet1
Set rCol = .Range("a2", .Range("A" & .Rows.Count).End(xlUp))
End With

'Loop through column A
For Each cell In rCol.Cells
'If a new value
If cell.Value < cell.Offset(-1, 0).Value Then
'Count the number of similar values in col A
lCount = Application.CountIf(rCol, cell.Value)
'Resize a range and print it out
cell.Resize(lCount,
cell.Parent.UsedRange.Columns.Count).PrintOut
End If
Next cell

End Sub

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Graham" wrote in message
...
I have a table made up of several columns and a variable number of rows
dependent on the entries required in different situations.When the table

has
been completed there will be several entries in column A for example which
will be duplicated, although the values in the rows will be different. ie
Column A indentifies the field being recorded. The table is sorted by

Column
A, by code, so that these entries are contiguous. ie there could be 7 rows
for Field 1, 12 rows for Field 2, etc. There could be up tp 100 Field 1
Field 2 etc. What I want to do is indentify all the entries for each of
these different row entries and set the relevent rows and columns as a

print
area which I would print along with some header rows. Thus I would print a
page for the entries relating to Field 1, another for field 2 etc. I had

set
up print areas using dynamic named ranges but I do not know how to

indentify
and show where a row has changed from one value to another. I hope this is
understandable and if so I would value any guidance.

Kind Regards,
Graham Haughs
Turriff
Scotland.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I print multiple print areas on one page Leo18 Excel Discussion (Misc queries) 1 January 11th 10 07:28 PM
Can I adjust print scaling for multiple print areas on the same sh N. Sammons Excel Discussion (Misc queries) 0 June 18th 08 10:24 PM
Need to print a workbook but worksheets have diff print areas Angela Steele Excel Discussion (Misc queries) 1 January 17th 08 07:39 PM
How do I perform summation over variable areas? Pithecanthropus Excel Discussion (Misc queries) 1 August 8th 07 07:02 PM
Variable Print Ranges Zshepherd Excel Discussion (Misc queries) 0 December 2nd 04 03:23 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"