LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Variable Printing Procedure

I use the procedure below to look for change of values in Column B then
at that change print out a range as shown. This works fine but it is not
ideal. The values down column B ideally should be one value followed by
some variable blanks before a new value appears in Column B and then I
would want to print out the range up to that point but not including the
new value. This would in turn be followed by some blanks before a new
value again appears and so on. The point that printing would need to
stop would be another challenge as the last value would appear and of
course it would be all blanks after that. It would be allowable to print
that one with up to four rows below it before stopping the procedure. It
is not possible to just print each value plus say five blanks as the
number of blanks after each value is variable. This may not be feasible
but I would value any guidance. Sorry if this is not explained very well.

Dim cell As Range
Dim l count As Long
Dim rCol As Range

'Get the last cell in column A
With Sheets("Field Records")
Set rCol = .Range("B10", .Range("B" & .Rows.Count).End(xlUp))
End With

'Loop through column B
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 B
lCount = Application.CountIf(rCol, cell.Value)
'Resize a range and print it out
cell.Resize(lCount, 16).PrintOut
End If
Next cell

Kind regards
Graham Haughs
Turriff, Scotland
 
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
Procedure name as variable Redbeard Excel Programming 15 May 2nd 06 11:17 AM
Variable procedure call Art Excel Programming 2 December 16th 05 01:16 PM
Call procedure using variable donbowyer Excel Programming 2 October 28th 05 09:21 AM
Public/Procedure Variable Otto Moehrbach[_6_] Excel Programming 2 February 6th 04 04:58 PM
can I call a procedure using a variable Santiago Gomez Excel Programming 8 December 24th 03 09:08 PM


All times are GMT +1. The time now is 03:01 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"