Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Code to set print range

District 1 Trends
Meat YTD 3 Mo
Avg Avg Nov-07 Oct-07
Store # 30
Smile 70 70 73 73
Attentive 74 69 67 68
Total 72 70 70 70
Store # 83
Smile 80 81 92 71
Attentive 75 66 65 60
Total 78 74 79 66
Store # 0
Smile #DIV/0! #DIV/0! n/a n/a
Attentive #DIV/0! #DIV/0! n/a n/a
Total #DIV/0! #DIV/0! n/a n/a
Store # 0
Smile #DIV/0! #DIV/0! n/a n/a
Attentive #DIV/0! #DIV/0! n/a n/a
Total #DIV/0! #DIV/0! n/a n/a

The "Store # 0" is just a format, the cell contains a zero.
Can somebody tell me how to write code to set the print range just above the
first cell in column A with "store # 0" in it? Also I would like to delete
all rows from the first "store # 0" down.
--
Thanks,
PTweety
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Code to set print range

One way:

Option Explicit
Sub testme()

Dim res As Variant

With Worksheets("sheet1")
res = Application.Match(0, .Range("a:a"), 0)

If IsError(res) Then
MsgBox "Store 0 wasn't found"
Else
If res 1 Then
.Rows("1:" & res - 1).Name = "'" & .Name & "'!Print_Area"
Else
MsgBox "print area not changed!"
End If
.Rows(res & ":" & .Rows.Count).Delete
End If
End With
End Sub

pickytweety wrote:

District 1 Trends
Meat YTD 3 Mo
Avg Avg Nov-07 Oct-07
Store # 30
Smile 70 70 73 73
Attentive 74 69 67 68
Total 72 70 70 70
Store # 83
Smile 80 81 92 71
Attentive 75 66 65 60
Total 78 74 79 66
Store # 0
Smile #DIV/0! #DIV/0! n/a n/a
Attentive #DIV/0! #DIV/0! n/a n/a
Total #DIV/0! #DIV/0! n/a n/a
Store # 0
Smile #DIV/0! #DIV/0! n/a n/a
Attentive #DIV/0! #DIV/0! n/a n/a
Total #DIV/0! #DIV/0! n/a n/a

The "Store # 0" is just a format, the cell contains a zero.
Can somebody tell me how to write code to set the print range just above the
first cell in column A with "store # 0" in it? Also I would like to delete
all rows from the first "store # 0" down.
--
Thanks,
PTweety


--

Dave Peterson
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
Print Blank Pgs - Preview margins outside print range dsm Excel Discussion (Misc queries) 0 October 25th 06 06:17 PM
Differentiate between 'Print' and 'Print Preview' in VBA code Mattantaliss Excel Programming 4 April 17th 06 09:31 PM
Code before Print but not Print Preview widemonk Excel Programming 1 November 14th 05 01:48 PM
Can you get the range reference for each page in a worksheet print range? Crosby Excel Programming 3 April 12th 05 06:06 PM
Excel 2000 VBA - Set Print Range in dynamic range sub_pop[_5_] Excel Programming 2 July 27th 04 08:01 PM


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