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


Hi,

Can you tell me what is wrong with this code?


wksDump.Range(Cells(2, 1), Cells(1000, 256)).ClearContents

If I put in wksdump.cells.clearcontents it clears the whole sheet. I
want to keep the data in row 1.

hope you can help.

Thanks,
Matt
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default clearing cells

Those Cells() don't refer to wksDump. If the code is in a general module, they
refer to the active sheet.

If the code is behind a worksheet, they refer to the sheet with the code:

Either:

wksDump.Range(wksdump.Cells(2, 1), wksdump.Cells(1000, 256)).ClearContents

or
with wksDump
.Range(.Cells(2, 1), .Cells(1000, 256)).ClearContents
end with

(notice the dots in front of .range() and both .cells().)

or even...

wksDump.Cells(2, 1).resize(999,256).clearcontents



MJKelly wrote:

Hi,

Can you tell me what is wrong with this code?

wksDump.Range(Cells(2, 1), Cells(1000, 256)).ClearContents

If I put in wksdump.cells.clearcontents it clears the whole sheet. I
want to keep the data in row 1.

hope you can help.

Thanks,
Matt


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default clearing cells

With Sheets(wksDump)
..Range(Cells(2, 1), Cells(1000, 256)).ClearContents
End With

I'm assuming that wksDump is the name of a sheet...

--
Ak


"MJKelly" wrote:


Hi,

Can you tell me what is wrong with this code?


wksDump.Range(Cells(2, 1), Cells(1000, 256)).ClearContents

If I put in wksdump.cells.clearcontents it clears the whole sheet. I
want to keep the data in row 1.

hope you can help.

Thanks,
Matt

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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing Cells plh Excel Programming 5 October 1st 07 07:12 PM
Clearing cells [email protected] Excel Programming 1 January 4th 06 09:48 PM
Clearing Cells mully New Users to Excel 3 May 19th 05 07:12 PM
Clearing cells hal Excel Programming 3 August 8th 03 04:01 PM


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