View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Deleting 63,886 Blank Rows Under My Data

One of the things that isn't apparent to me is what the .range() and .cells()
refer to.

There's a "with ..." statement that you haven't shared. Maybe it's not what you
think.

If you're using a variable in that with statement, share what it holds, too.

rory_r wrote:

I ran the MSG box and it returned 0
After I run the script and get the error (with the option of running the
debugger), the spread sheets extra rows over 600 are gone. So it seems to
work to that point.

As far as protected, it's not, it probably should be tho.
Rory

"Dave Peterson" wrote:

I'm guessing that it's the first logical line (first 2 lines of code) that is
causing the trouble.

What does myLastRow equal?

Add
MsgBox MyLastRow
right before this portion of code.

And is there any chance that the worksheet is protected?

rory_r wrote:

Thanks for this info.I used it too.
However I keep getting an error when I run the same script from the link.
the debugger stops here- with an application-defined or object defined errror.

Else
.Range(.Cells(myLastRow + 1, 1), _
.Cells(.Rows.Count, 1)).EntireRow.Delete
.Range(.Cells(1, myLastCol + 1), _
.Cells(1, .Columns.Count)).EntireColumn.Delete
End If
End With

Any ideas
Rory

"T. Valko" wrote:

See this:

http://contextures.com/xlfaqApp.html#Unused

Note that when you "delete" the unused rows you're not literally removing
them from the the sheet. Technically, what you're actually doing is
resetting the *used range*.

--
Biff
Microsoft Excel MVP


"Kajuliano" wrote in message
...
I am working on an excel file in which I currently have data in 1,650 rows
and there are blank cells within the rows I am working on that need to
stay
blank. My main problem is deleteing the extra 65,536 blank rows below my
data
that randomly appeared when I copy and pasted my data to a new workbook.
When
I highlight a single blank row or many blank rows beneath my data and hit
delete row, they do not go away and it is really annoying because my
scroll
bar had become all but useless- please help! Thanks!




--

Dave Peterson


--

Dave Peterson