Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following which will insert a copy of a row. I want to clear
columns D through AD of the inserted row and leave the other columns intact (they have some formulas). The last statement below seems to do nothing. InputCI is a defined row name. Sub InsertARow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-1, 0).Select Selection.ClearContents End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this:
Sub InsertArow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-2, 0).Select Selection.Cells(1, 4).Resize(1, 27).ClearContents End Sub -- Regards, Tom Ogilvy "Scott" wrote: I have the following which will insert a copy of a row. I want to clear columns D through AD of the inserted row and leave the other columns intact (they have some formulas). The last statement below seems to do nothing. InputCI is a defined row name. Sub InsertARow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-1, 0).Select Selection.ClearContents End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That did not clear the cells.
"Tom Ogilvy" wrote: try this: Sub InsertArow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-2, 0).Select Selection.Cells(1, 4).Resize(1, 27).ClearContents End Sub -- Regards, Tom Ogilvy "Scott" wrote: I have the following which will insert a copy of a row. I want to clear columns D through AD of the inserted row and leave the other columns intact (they have some formulas). The last statement below seems to do nothing. InputCI is a defined row name. Sub InsertARow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-1, 0).Select Selection.ClearContents End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In contrast, it did for me. so apparently we have a different
interpretation of what InputCI actually is. -- Regards, Tom Ogilvy "Scott" wrote: That did not clear the cells. "Tom Ogilvy" wrote: try this: Sub InsertArow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-2, 0).Select Selection.Cells(1, 4).Resize(1, 27).ClearContents End Sub -- Regards, Tom Ogilvy "Scott" wrote: I have the following which will insert a copy of a row. I want to clear columns D through AD of the inserted row and leave the other columns intact (they have some formulas). The last statement below seems to do nothing. InputCI is a defined row name. Sub InsertARow(InputCI) Range(InputCI).Offset(-2, 0).Select Selection.Copy Range(InputCI).Offset(-1, 0).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range(InputCI).Offset(-1, 0).Select Selection.ClearContents End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combining find with clearcontents on multiple columns | Excel Programming | |||
Clearcontents | Excel Programming | |||
Clearcontents | Excel Programming | |||
Clearcontents | Excel Programming | |||
Error of ClearContents | Excel Programming |