Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The problem is that your Cells function isn't (necessarily) pointing
to the worksheet "a lap". Because it is unqualified (doesn't have a worksheet prefix), it points to the either the ActiveSheet if the code is in a regular module, or the worksheet in which the code resides. Use With Sheets("a lap") .Range(.Cells(Target.Row, MaxCol + 4), _ .Cells(Target.Row, 256)).ClearContents End With Note the leading periods. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 4 Sep 2009 01:51:05 -0700, NDBC wrote: Could you please tel me why this wouldn't work Sheets("a lap").Range(Cells(Target.Row, MaxCol + 4), Cells(Target.Row, _ 256)).ClearContents I'm running it from some code in a sheet called A grade if that makes a difference. Maxcol is dim as integer. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting range | Excel Programming | |||
Deleting a range | Excel Programming | |||
Deleting Range name's listed in the range address box. | Excel Discussion (Misc queries) | |||
Deleting Range using VB | Excel Programming | |||
Deleting range not a row | Excel Programming |