Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default protected worksheet

I have prepared a worksheet for user entry in which there are formulas.
The worksheet is protected and I am trying to have interim reports printed
using a
macro. When the current region is selected in the macro, the entire area
including
empty cells with the formulas copied, is selected. How do I get the print
area to
stop at the point where data has been entered, excluding the empty,
formatted rows.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default protected worksheet


Say your current region range is Rg and it is set.
Let's call rgStart, rgEnd as range for first and last cells of the table to
be printed.
Dim rgStart as Range, rgEnd as range

-Start Cell
set rgStart = Rg.cells(1)
- last Row
Now, do you know any column where the last the last non-empty cell would
define the last row of the table to be printed?
Say column E is such a column:
Dim rg1
Set rg1 = Rg.parent.Range("E65536").End(xlUp)
- End cell:
It is at the intesection of rg1's row and rg's last column:
set rgEnd = application.intersect(Rg.Cells(Rg.Cells.Count).Ent ireColumn ,
rg1.EntireRow)
- Finally the new range to print, Rg :
Set Rg=Range(rgStart, rgEnd)

Regards,
Sebastien

"LennyG" wrote:

I have prepared a worksheet for user entry in which there are formulas.
The worksheet is protected and I am trying to have interim reports printed
using a
macro. When the current region is selected in the macro, the entire area
including
empty cells with the formulas copied, is selected. How do I get the print
area to
stop at the point where data has been entered, excluding the empty,
formatted rows.

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
Worksheet protected R Ormerod Excel Discussion (Misc queries) 2 July 15th 08 06:15 PM
Edit text format in non-protected cells in protected worksheet Bonnie Excel Discussion (Misc queries) 2 April 19th 08 04:48 PM
Protected worksheet baseballmm Excel Worksheet Functions 1 June 4th 07 11:59 PM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM
Is worksheet protected? Kolmyk AE Excel Programming 1 July 13th 04 10:18 AM


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