PC Review


Reply
Thread Tools Rate Thread

Clearing used range?

 
 
jodleren
Guest
Posts: n/a
 
      17th Mar 2010
I want to clear data, meaning that I delete anything below row 4, en
after say "D"

Right now it jumps to EE10000 as the last cell, eg highest cell.

This code does not work

ws.Rows("200:65536").EntireRow.Delete
ws.Columns("Z:IV").EntireColumn.Delete
ws.UsedRange ' invalid use of property?

Sonnich
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      17th Mar 2010
Have a look at http://contextures.com/xlfaqApp.html#Unused

--

HTH

Bob

"jodleren" <(E-Mail Removed)> wrote in message
news:5db301a7-b3bb-4b69-b9fb-(E-Mail Removed)...
>I want to clear data, meaning that I delete anything below row 4, en
> after say "D"
>
> Right now it jumps to EE10000 as the last cell, eg highest cell.
>
> This code does not work
>
> ws.Rows("200:65536").EntireRow.Delete
> ws.Columns("Z:IV").EntireColumn.Delete
> ws.UsedRange ' invalid use of property?
>
> Sonnich



 
Reply With Quote
 
jodleren
Guest
Posts: n/a
 
      17th Mar 2010
On Mar 17, 11:41*am, "Bob Phillips" <bob.phill...@somewhere.com>
wrote:
> Have a look athttp://contextures.com/xlfaqApp.html#Unused
>
> --
>
> HTH
>
> Bob
>
> "jodleren" <sonn...@hot.ee> wrote in message
>
> news:5db301a7-b3bb-4b69-b9fb-(E-Mail Removed)...
>
> >I want to clear data, meaning that I delete anything below row 4, en
> > after say "D"

>
> > Right now it jumps to EE10000 as the last cell, eg highest cell.

>
> > This code does not work

>
> > ws.Rows("200:65536").EntireRow.Delete
> > ws.Columns("Z:IV").EntireColumn.Delete
> > ws.UsedRange ' invalid use of property?

>
> > Sonnich


Yes..... does not change anything

 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      17th Mar 2010
Hi,

Dim ws As Worksheet

Set ws = Sheets("Sheet2")

'dispense with EntireRow and EntireColumn
'Have already said Row and Column which
'means Entire Row or Entire column.
ws.Rows("200:65536").Delete
ws.Columns("Z:IV").Delete

'Need to do something with UsedRange
'Your example is a bit like entering
'ws.Range ("A110")

'ws.UsedRange ' invalid use of property?

'**********************************

alternative method

Dim ws As Worksheet
Dim lastRow As Long

Set ws = Sheets("Sheet2")

'Find last row of used range
With ws.UsedRange
lastRow = .Rows(.Rows.Count).Row
End With

ws.Rows(200 & ":" & lastRow).Delete

ws.Columns("Z:IV").Delete


--
Regards,

OssieMac


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing Row data for a given range Santhosh Pasupuleti Microsoft Excel Programming 12 8th Sep 2009 05:58 PM
Clearing contents from a range G. Yamada Microsoft Excel Programming 13 25th Sep 2008 07:45 PM
need some help clearing a range Gary Keramidas Microsoft Excel Programming 4 18th Aug 2006 03:07 AM
Clearing a Range Ronald Cayne Microsoft Excel Programming 4 12th Sep 2004 04:00 AM
used range after clearing cells BigRog Microsoft Excel Misc 1 9th Mar 2004 08:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 PM.