![]() |
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 |
clearing cells
cells is the whole sheet -- Don Guillett Microsoft MVP Excel SalesAid Software "MJKelly" wrote in message ... 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 |
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 |
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 |
All times are GMT +1. The time now is 07:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com