Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Set Print Area with Dynamic Start Point

I want to test a row for a date, for the start cell, for the print area.
Using that cell as a start, select 11 more columns, and 44 rows to set the
print area.

Sub Test1 ()


Range("G17").Select

Do While ((ActiveCell) < Range("B4"))
ActiveCell.Offset(0, 1).Select
If ((ActiveCell) = Range("D2")) Then
Exit Do
End If
Loop

'SET PRINT AREA

((First cell of print area would be the cell the loop stops on.
Then down 44 row and over 12 columns))

ActiveSheet.PageSetup.PrintArea = SOME CODE

ActiveWindow.SelectedSheets.PrintPreview

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Set Print Area with Dynamic Start Point

Try this

Sub setprintarea()
lc = Cells(17, Columns.Count).End(xlToLeft).Column
Set mf = Range(Cells(17, "g"), Cells(17, lc)) _
..find(What:=Range("d2"), After:=Range("g17"), _
LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext)
If Not mf Is Nothing Then
'MsgBox mf.Column
Cells(17, mf.Column).Resize(4, 12).PrintPreview 'printOUT
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"StonyfieldRob" wrote in message
...
I want to test a row for a date, for the start cell, for the print area.
Using that cell as a start, select 11 more columns, and 44 rows to set the
print area.

Sub Test1 ()


Range("G17").Select

Do While ((ActiveCell) < Range("B4"))
ActiveCell.Offset(0, 1).Select
If ((ActiveCell) = Range("D2")) Then
Exit Do
End If
Loop

'SET PRINT AREA

((First cell of print area would be the cell the loop stops on.
Then down 44 row and over 12 columns))

ActiveSheet.PageSetup.PrintArea = SOME CODE

ActiveWindow.SelectedSheets.PrintPreview

End Sub


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
Dynamic Print Area FirstVette52 Excel Programming 5 February 19th 09 03:39 PM
Dynamic Print Area FirstVette52 Excel Programming 0 February 10th 09 07:34 PM
Dynamic Print Area Huddle Excel Discussion (Misc queries) 7 February 7th 07 04:55 PM
dynamic print area GeorgeW Excel Worksheet Functions 7 February 23rd 06 06:11 PM
select dynamic range with dynamic start point Juli Excel Programming 1 August 31st 05 12:05 AM


All times are GMT +1. The time now is 05:15 AM.

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

About Us

"It's about Microsoft Excel"