Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Blank portions of the worksheet after the data


How would I delete the blank pages of a worksheet that remain after th
cells that contain data? I have a macro that reads data from a
unformatted worksheet into another formatted worksheet. The amount o
data coming into the spreadsheet varies. When I run a report with
small amount of data after running one with a large amount of dat
there are a lot of empty pages. I can set the cells to blank befor
filling the spreadsheet, IE:Worksheets("Rebate").Range("A2:J7000")
"". I'm just wondering if I can delete the remaining empty cells.
want to do this in the macro.

Thank

--
David
-----------------------------------------------------------------------
DavidW's Profile: http://www.excelforum.com/member.php...fo&userid=3263
View this thread: http://www.excelforum.com/showthread.php?threadid=52960

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Blank portions of the worksheet after the data

Sub ClearExtraCells()
Range("A1").CurrentRegion.Select
Selection.Offset(Selection.Rows.Count).Resize(1, 1).Select
Range(ActiveCell, Range("A65536")).EntireRow.Clear
Range("A1").CurrentRegion.Select
Selection.Offset(0, Selection.Columns.Count).Resize(1, 1).Select
Range(ActiveCell, Range("IV1")).EntireColumn.Clear
End Sub

"DavidW" wrote:


How would I delete the blank pages of a worksheet that remain after the
cells that contain data? I have a macro that reads data from an
unformatted worksheet into another formatted worksheet. The amount of
data coming into the spreadsheet varies. When I run a report with a
small amount of data after running one with a large amount of data
there are a lot of empty pages. I can set the cells to blank before
filling the spreadsheet, IE:Worksheets("Rebate").Range("A2:J7000") =
"". I'm just wondering if I can delete the remaining empty cells. I
want to do this in the macro.

Thanks


--
DavidW
------------------------------------------------------------------------
DavidW's Profile: http://www.excelforum.com/member.php...o&userid=32630
View this thread: http://www.excelforum.com/showthread...hreadid=529601


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Blank portions of the worksheet after the data

DavidW - Instead of posting your data directly to the "formatted" worksheet,
consider making a copy of the "formatted" worksheet and pasting your data to
the "formatted copy". That way there is no "remembering" the previous print
job.

Make sure your "source formatted" worksheet is as small as possible. While
on the worksheet, press "END" then "HOME" to located the last remembered
cell. If this is position is acceptable, then your are okay. If not, then
recreate your "source formatted" worksheet.

As a side note: I find that shading is a problem for me. Even if you remove
it (by "unshading" or deleting rows/columns, Excel still rembembers that
those cells were once shaded).

Hope this suggestion helps.

Thx
MSweetG222


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Blank portions of the worksheet after the data


Thanks, Martin and MSweet. Both suggestions make sense, but it looks
like I'll have to wait until tomorrow to try them. I'm swamped with
other things now.


--
DavidW
------------------------------------------------------------------------
DavidW's Profile: http://www.excelforum.com/member.php...o&userid=32630
View this thread: http://www.excelforum.com/showthread...hreadid=529601

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
Why do portions of my worksheet often disappear? mmc Excel Discussion (Misc queries) 1 October 28th 09 09:00 PM
Conditional functions on portions of cell data sabow71 Excel Worksheet Functions 4 April 22nd 09 04:49 PM
Protecting portions of worksheet alwayskristie Excel Worksheet Functions 1 April 18th 07 06:33 PM
Copying portions of data Wendy Clarkson Excel Discussion (Misc queries) 2 January 14th 05 11:51 PM
Divide data into portions pauluk[_27_] Excel Programming 0 April 15th 04 06:12 PM


All times are GMT +1. The time now is 07:25 PM.

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"